Skip to content

Commit 7ca9690

Browse files
committed
process_tracker_python-1 Add support for other relational databases
✨ Added Support for Oracle and SQL Server In addition to Postgresql, MySQL, and Snowflake, have now added support for Oracle and SQL Server. The Oracle, SQL Server, and Snowflake are not tested at this time - working on setting up local data stores. At the moment, can't test them with Travis as they are not available. I do plan on testing them thoroughly locally like I have with Postgres and MySQL. One thing I've noticed is that likely due to the processing differences between systems, tests that pass locally may fail so there is some (very slight) risk something may go bork without more higher powered testing. Closes #1
1 parent 0c9bc0c commit 7ca9690

File tree

4 files changed

+112
-8
lines changed

4 files changed

+112
-8
lines changed

Pipfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ psycopg2-binary="*"
1919
google-compute-engine = "*"
2020
snowflake-sqlalchemy = "*"
2121
pymysql = "*"
22+
cx-oracle = "*"
23+
pymssql = "*"
2224

2325
[requires]
2426
python_version = "3.7"

Pipfile.lock

Lines changed: 91 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

process_tracker/data_store.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
preload_process_types = ['extract', 'load']
2323
preload_system_keys = [{'key': 'version', 'value': '0.1.0'}]
2424

25+
relational_stores = ['postgresql', 'mysql', 'oracle', 'mssql', 'snowflake']
26+
nonrelational_stores = []
27+
28+
supported_data_stores = relational_stores + nonrelational_stores
29+
2530

2631
class DataStore:
2732

@@ -362,18 +367,15 @@ def verify_and_connect_to_data_store(self):
362367

363368
raise Exception(errors)
364369

365-
relational_stores = ['postgresql', 'mysql', 'snowflake']
366-
nonrelational_stores = []
367-
368-
supported_data_stores = relational_stores + nonrelational_stores
369-
370370
if data_store_type in supported_data_stores:
371371
engine = ''
372372
meta = ''
373373
session = ''
374374

375375
if data_store_type in relational_stores:
376-
if data_store_type == 'postgresql' or data_store_type == 'snowflake':
376+
if data_store_type == 'postgresql' \
377+
or data_store_type == 'oracle'\
378+
or data_store_type == 'snowflake':
377379

378380
engine = create_engine(data_store_type + '://' + data_store_username + ':' + data_store_password
379381
+ '@' + data_store_host + '/' + data_store_name)
@@ -382,6 +384,10 @@ def verify_and_connect_to_data_store(self):
382384

383385
engine = create_engine('mysql+pymysql://' + data_store_username + ':' + data_store_password + '@'
384386
+ data_store_host + '/' + data_store_name)
387+
elif data_store_type == 'mssql':
388+
389+
engine = create_engine('mssql+pymssql://' + data_store_username + ':' + data_store_password + '@'
390+
+ data_store_host + '/' + data_store_name)
385391

386392
else:
387393
self.logger.error("Data store type valid but not configured.")

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
install_requires=[
2020
'boto3 >= 1.9.150',
2121
'Click >= 7.0',
22+
'cs-oracle >= 7.1.3'
2223
'google-compute-engine >= 2.8.13',
24+
'psycopg2-binary >= 2.8.2',
25+
'pymysql >= 0.9.3',
26+
'pymssql >= 2.1.4',
27+
'python-dateutil >= 2.8.0',
28+
'snowflake-sqlalchemy >= 1.1.13'
2329
'sqlalchemy >= 1.3.3',
2430
'sqlalchemy-utils >= 0.33.11',
2531
'pymysql >= 0.9.3',
@@ -29,9 +35,9 @@
2935
extras_requires={
3036
'dev': [
3137
'coverage >= "4.0.3',
38+
'coveralls >= 1.7.0',
3239
'moto >= 1.3.8'
3340
'python-coveralls >= 2.9.1',
34-
'coveralls >= 1.7.0',
3541
]
3642
},
3743
entry_points = {

0 commit comments

Comments
 (0)