Documentation for results?

Hello! I am investigating using Databases in conjunction with FastAPI and SQLAlchemy.

However, I am running into trouble with returned values not offering dict-style access to their values, and was wondering if there is any documentation for what exactly fetch_one, fetch_all and so forth actually return (along with any errors they might throw).

Hi @OneCrayon,

It’s a good point, the documentation around this might be not fully covered.
And, if I’m not mistaken, it’s something being established at the moment.

The matter is that despite of the unified interface across different DB backend there’re some subtle differences at the driver level in terms of the returned data. Additionally, it might also depend how you form queries: sqlalchemy-core or sqlalchemy's raw queries or just pure raw queries.

And wile fetch* methods will return records, execute* methods do not return data, but in some backends can catch the db state response (like INSERT 0 5 or COPY 0 4), which is not generally exposed.

Also you can access the raw driver.

In meantime, do you have some particular use cases in mind? And what backends are you using?

Currently I am experimenting against a local SQLite database, but will actually be working with PostgreSQL if I move forward with Databases and FastAPI for an actual project. I’ve actually been successful in getting dict-style access for results with SQLAlchemy queries recently, so I’m not sure what changed (maybe the way I’m composing my SQL, since I’m experimenting with a sort of ORM-lite to allow Select composition via the standard declarative SQLAlchemy classes, but doing away with all the other ORM-related magic). In any case, I would love to see better documentation about exactly what Databases is doing lower down so I know what to expect when switching drivers or similar.

Yup - agreed that the docs could do with some improvement here. Also the API itself needs a little tightening down. (See