forked from codonlibrary/codonPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL_connections.py
More file actions
33 lines (23 loc) · 1 KB
/
Copy pathSQL_connections.py
File metadata and controls
33 lines (23 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
''' Author(s): Sam Hollings
Desc: this module contains SQL_alchemy engines to connect to commonly used databases'''
from sqlalchemy import create_engine
def conn_dss():
'''Returns sqlalchemy Engine to connect to the DSS 2008 server (DMEDSS) DSS_CORPORATE database '''
engine = create_engine('mssql+pyodbc://DMEDSS/DSS_CORPORATE?driver=SQL+Server')
return engine
def conn_dss2016uat():
'''Returns sqlalchemy Engine to connect to the DSS 2016 server (UAT) (DSSUAT) DSS_CORPORATE database '''
conn = create_engine('mssql+pyodbc://DSSUAT/DSS_CORPORATE?driver=SQL+Server')
return conn
def conn_dummy(path=r''):
'''connect to the sqlite3 database in memory, or at specified path
parameters
----------
path : string
The location and file in which the database for conn_dummy will be stored. Default is memory (RAM)
'''
conn_string = 'sqlite://'
if path != '':
path = '/' + path
conn = create_engine(r'{0}{1}'.format(conn_string, path))
return conn