Skip to content

Instantly share code, notes, and snippets.

@michaeltoohig
michaeltoohig / README.md
Last active April 11, 2025 12:22
SQLAlchemy-Continuum plugin for FastAPI with FastAPI-Users and async SQLAlchemy

The files here are the "full example" from the FastAPI-Users documenation plus some modifications for async SQLAlchemy 1.4 (maybe also 2.0?). All together it produces a simple example of using SQLAlchemy-Continuum with the transaction table having a relationship to the user.

But for most users I think the plugin.py, middleware.py and users.py files gives the basic gist of what is needed to use FastAPI with SQLAlchemy-Continuum.

EDIT: it appears less than two weeks ago an update to FastAPI may make all of the issues I was facing moot. https://github.com/tiangolo/fastapi/releases/tag/0.74.1 Keep an eye on newer versions of FastAPI and see if this gist is relevant to you in the future.

file tree

@tankhuu
tankhuu / amazon_linux_install_goaccess.sh
Created January 15, 2019 11:57
Install GoAccess - real-time web log analyzer in Amazon Linux
sudo yum install ncurses-devel geoip-devel libmaxminddb-devel tokyocabinet-devel openssl-devel
wget https://tar.goaccess.io/goaccess-1.3.tar.gz
tar -xzvf goaccess-1.3.tar.gz
cd goaccess-1.3/
./configure --enable-utf8 --enable-geoip=legacy
make
sudo make install
# Run
# goaccess /var/log/nginx/access.log -c
"I think we need to create cron management command (say, once per hour) or sync in a background task while login as you suggested to import data from git to django db. Also, we need to check for git conflicts while MDstatement is saving (pre_save signal) (return an error to a user if local git repo is outdated)."
>>So we need effectively an idempotent sync, that will be triggered by cron, login, and after save conflicts. Correct?
"'that we will need an API to add/modify/delete a MDstatement.'
Also, we need API for checkout status in this way."
>>Please explain. I thought, that an API-transaction (add/replace/delete) will be stateless, not requiring a checkout, only throwing an error if a lock exists.
ChangeView signal / API checkout method (create a new CheckOut status)