-
Notifications
You must be signed in to change notification settings - Fork 0
3. FAQ
I'm not sure yet. TODO: this!
See https://superfastpython.com/asynchronous-iterators/ . Effectively, it's just an iterator that awaits each iteration of a loop, so other tasks can be done in the meantime. A good example of this might be a chain of internet requests that need to be made, ex: fetch a.html
-> fetch b.css
-> fetch c.jpg
.
see https://fastapi.tiangolo.com/tutorial/dependencies/
4. Why is response: Response
in the parameters? Shouldn't it be returned in the object or something?
fastapi is silly sometimes, this is just how it is I guess...
https://docs.python.org/3/library/asyncio-task.html#awaitables
Good luck my friend
The test database is for use without worrying about alembic migrations, while the main database is for testing that alembic migrations worked properly.
To activate the main database, export LOCAL=false
, otherwise if you want to enable the test database export LOCAL=true
.
See https://stackoverflow.com/questions/9667138/how-to-update-sqlalchemy-row-entry. Essentially, there are many ways! I encourage you to use the SQL-like method of:
query = (
sqlalchemy
.update()
.values(no_of_logins=User.no_of_logins + 1)
.where(User.username == form.username.data)
)