FastAPI - Database Integration
You want to fetch all users from a database asynchronously using the
databases library in FastAPI. Which code snippet correctly fetches all rows and returns them as a list of dictionaries?database = databases.Database('sqlite:///test.db')
async def get_users():
query = 'SELECT * FROM users'
# Which line correctly fetches all rows?
???
return users