Projekt

Obecné

Profil

Stáhnout (737 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1 aba60b70 Matej Zeman
from sqlalchemy import create_engine
2
from sqlalchemy.ext.declarative import declarative_base
3
from sqlalchemy.orm import sessionmaker
4 4911f0ea Matej Zeman
5
6 4babde6c Matej Zeman
'''
7 4911f0ea Matej Zeman
# used mainly for testing purposes. Creates local sqllite data file
8 aba60b70 Matej Zeman
SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db"
9
engine = create_engine(
10
    SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
11
)
12 b49b6e3d Matej Zeman
'''
13 4911f0ea Matej Zeman
14
# Defining connection url with postgresql database
15 2229e0e1 Matej Zeman
SQLALCHEMY_DATABASE_URL = "postgresql://postgres:postgres@10.5.0.5:5432/usb_api_db"
16 ef87a1d2 Matej Zeman
17 4911f0ea Matej Zeman
# Creating engine for database communication
18 b49b6e3d Matej Zeman
engine = create_engine(
19
    SQLALCHEMY_DATABASE_URL
20
)
21 4babde6c Matej Zeman
22 4911f0ea Matej Zeman
# Session maker for data transmissions
23 aba60b70 Matej Zeman
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
24
25 8fd3d7e5 Matej Zeman
Base = declarative_base()