Coverage for docs_src/sql_databases/sql_app_py39/database.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from sqlalchemy import create_engine 1abcd

2from sqlalchemy.ext.declarative import declarative_base 1abcd

3from sqlalchemy.orm import sessionmaker 1abcd

4 

5SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db" 1abcd

6# SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db" 

7 

8engine = create_engine( 1abcd

9 SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} 

10) 

11SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) 1abcd

12 

13Base = declarative_base() 1abcd