Coverage for docs_src/sql_databases/sql_app/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 1abcde

2from sqlalchemy.ext.declarative import declarative_base 1abcde

3from sqlalchemy.orm import sessionmaker 1abcde

4 

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

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

7 

8engine = create_engine( 1abcde

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

10) 

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

12 

13Base = declarative_base() 1abcde