From 67b91b43ab24c47abb987cfe3f03a7f2b64bfba3 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Tue, 23 Apr 2024 13:00:14 -0500 Subject: [PATCH] new: sqlserver and other refactoring --- info/__init__.py | 2 +- setup.py | 8 ++++---- transport/providers/__init__.py | 4 +++- transport/sql/__init__.py | 2 +- transport/sql/sqlserver.py | 24 ++++++++++++++++++++++++ 5 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 transport/sql/sqlserver.py diff --git a/info/__init__.py b/info/__init__.py index 2d27032..0594d12 100644 --- a/info/__init__.py +++ b/info/__init__.py @@ -1,5 +1,5 @@ __author__ = 'The Phi Technology' -__version__= '2.0.0' +__version__= '2.0.2' __license__=""" diff --git a/setup.py b/setup.py index 3df143d..8e9de26 100644 --- a/setup.py +++ b/setup.py @@ -22,10 +22,10 @@ args = { "packages": find_packages(include=['info','transport', 'transport.*'])} args["keywords"]=['mongodb','couchdb','rabbitmq','file','read','write','s3','sqlite'] -args["install_requires"] = ['pyncclient','pymongo','sqlalchemy','pandas','typer','pandas-gbq','numpy','cloudant','pika','nzpy','boto3','boto','pyarrow','google-cloud-bigquery','google-cloud-bigquery-storage','flask-session','smart_open','botocore','psycopg2-binary','mysql-connector-python','numpy'] +args["install_requires"] = ['pyncclient','pymongo','sqlalchemy','pandas','typer','pandas-gbq','numpy','cloudant','pika','nzpy','boto3','boto','pyarrow','google-cloud-bigquery','google-cloud-bigquery-storage','flask-session','smart_open','botocore','psycopg2-binary','mysql-connector-python','numpy','pymssql'] args["url"] = "https://healthcareio.the-phi.com/git/code/transport.git" args['scripts'] = ['bin/transport'] -if sys.version_info[0] == 2 : - args['use_2to3'] = True - args['use_2to3_exclude_fixers']=['lib2to3.fixes.fix_import'] +# if sys.version_info[0] == 2 : +# args['use_2to3'] = True +# args['use_2to3_exclude_fixers']=['lib2to3.fixes.fix_import'] setup(**args) diff --git a/transport/providers/__init__.py b/transport/providers/__init__.py index fc0f1e7..4a583f7 100644 --- a/transport/providers/__init__.py +++ b/transport/providers/__init__.py @@ -26,7 +26,9 @@ S3 = 's3' CALLBACK = 'callback' CONSOLE = 'console' RABBITMQ = 'rabbitmq' -DATABRICKS= 'databricks' +DATABRICKS = 'databricks' +MSSQL ='sqlserver' +SQLSERVER ='sqlserver' # # synonyms of the above diff --git a/transport/sql/__init__.py b/transport/sql/__init__.py index 557d36d..9d026bf 100644 --- a/transport/sql/__init__.py +++ b/transport/sql/__init__.py @@ -3,7 +3,7 @@ This namespace/package wrap the sql functionalities for a certain data-stores - netezza, postgresql, mysql and sqlite - mariadb, redshift (also included) """ -from . import postgresql, mysql, netezza, sqlite +from . import postgresql, mysql, netezza, sqlite, sqlserver # diff --git a/transport/sql/sqlserver.py b/transport/sql/sqlserver.py new file mode 100644 index 0000000..6a53842 --- /dev/null +++ b/transport/sql/sqlserver.py @@ -0,0 +1,24 @@ +""" +Handling Microsoft SQL Server via pymssql driver/connector +""" +import sqlalchemy +import pandas as pd +from transport.sql.common import Base, BaseReader, BaseWriter + + +class MsSQLServer: + def __init__(self,**_args) : + super().__init__(**_args) + pass + def get_provider(self): + # mssql+pymssql://scott:tiger@hostname:port/dbname" + return "mssql+pymssql" + def get_default_port(self): + return "1433" +class Reader (MsSQLServer,BaseReader): + def __init__(self,**_args): + super().__init__(**_args) + +class Writer (MsSQLServer,BaseWriter): + def __init__(self,**_args): + super().__init__(**_args) \ No newline at end of file