mdslino / fastapi-sqlalchemy-async Goto Github PK
View Code? Open in Web Editor NEWRepository with a example app running FastAPI accessing database with SQLAlchemy asynchronous
Repository with a example app running FastAPI accessing database with SQLAlchemy asynchronous
please add tests
Hello,
What is the path for creating alembic migrations? If I do it on my host machine. First, I had to add the following lines to env.py, so alembic could find the model files:
import sys
sys.path = ['', '..'] + sys.path[1:]
Then, if i try to generate migrations on my host, i get issues that all the POSTGRES variables are missing:
alembic revision --autogenerate -m "test migration"
...
pydantic.error_wrappers.ValidationError: 8 validation errors for Settings
SERVER_NAME
field required (type=value_error.missing)
PROJECT_NAME
field required (type=value_error.missing)
POSTGRES_SCHEME
field required (type=value_error.missing)
POSTGRES_SERVER
field required (type=value_error.missing)
POSTGRES_USER
field required (type=value_error.missing)
POSTGRES_PASSWORD
field required (type=value_error.missing)
POSTGRES_DB
field required (type=value_error.missing)
SQLALCHEMY_DATABASE_URI
unsupported operand type(s) for +: 'NoneType' and 'str' (type=type_error)
If I exec
in to my app
container and run the migration there, I get connection issues:
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
A few endpoints rely on the current user being a super user. However, when creating a user, there's no way to specify a user as being a super user, and the DB column defaults to false.
I believe that updating UserBase
in the pydantic model to include the superuser field will do it, as well as updating the DB opertions in crud_user.py
.
Also, the application has Groups, but they're not actually used.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.