- def conn_string(dsn):
- if dsn["driver"] == "mssql":
- return f"mssql+pyodbc://{dsn['user']}:{dsn['password']}@{dsn['server']}/{dsn['database']}?driver=SQL+Server+Native+Client+11.0"
- if dsn["driver"] == "mysql":
- return f"mysql+pymysql://{dsn['user']}:{dsn['password']}@{dsn['server']}/{dsn['database']}?charset=utf8mb4"
- return f"pyodbc://{dsn['user']}:{dsn['pass']}@{dsn['server']}/{dsn['database']}?driver={dsn['driver']}"
- def bcp_conn_params(dsn):
- return f"-S {dsn['server']} -d {dsn['database']} -U {dsn['user']} -P {dsn['password']}"
- def mysql_conn_params(dsn):
- return f"-h {dsn['server']} -D {dsn['database']} -u {dsn['user']} -p {dsn['password']}"
|