Skip to content

CAprogs/fastapi-json-query

Repository files navigation

FastAPI x JSONB queries - A quick example

Pre-requisites

Run the app

just serve

How to query a fastapi application using json functions ( Sqlite example )

Here is an interesting discussion about it

SQlite JSONB format

You will find informations about the SQLite JSONB format here The diverse JSON functions to query json paths are well documented here

In SQlite, we have to create the column as a BLOB, which will be read as JSONB when queried. In PostgreSQL, we can use the JSONB data type directly via the sqlalchemy.dialects.postgresql.JSONB.

Creating Fake data

We used the well-known Faker library to generate fake data for our application.

Author

About

A demo repo using fastapi, sqlalchemy and pydantic

Topics

Resources

Stars

Watchers

Forks