Skip to content
Discussion options

You must be logged in to vote

Hello, it appears that you're using synchronous sqlalchemy API with async endpoint, it would be better if you use asynchronous sqlalchemy API or make your endpoint function synchronous (but it would lead to extra costs due to that function running in a thread executor)

Also you should use new SQLAlchemy 2.0 select API instead of legacy Session.query

You can also simplify your dependency function:

def db_session():
    with SessionLocal() as session:
        yield session

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@nabarunn
Comment options

@PancakePuncher
Comment options

Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
3 participants