8 lines
389 B
Python
8 lines
389 B
Python
from app.config import Config
|
|
from sqlalchemy import create_engine
|
|
from urllib.parse import quote_plus
|
|
|
|
def get_engine_for_company(company_id: str):
|
|
schema = f"hitpbx_{company_id}"
|
|
db_url = f"mysql+pymysql://{Config.MYSQL_USER}:{quote_plus(Config.MYSQL_PASS)}@{Config.MYSQL_HOST}:{Config.MYSQL_PORT}/{schema}?charset=utf8mb4"
|
|
return create_engine(db_url, pool_pre_ping=True) |