-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabases.py
More file actions
18 lines (13 loc) · 787 Bytes
/
databases.py
File metadata and controls
18 lines (13 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import configparser
config = configparser.ConfigParser()
config.read('/Users/p.matchenkov/Desktop/configurations/config.ini')
password, localhost, bd_type, bd_name, login = (config['DXCORE_prod']['password'], config['DXCORE_prod']['localhost'],
config['DXCORE_prod']['bd_type'], config['DXCORE_prod']['bd_name'],
config['DXCORE_prod']['login'])
DX_BASE_URL = f'{bd_type}://{login}:{password}@{localhost}/{bd_name}'
engine = create_engine(DX_BASE_URL)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()