bug fix: ... minor update sqlalchemy

This commit is contained in:
Steve Nyemba 2022-03-31 17:13:24 -05:00
parent e5fadc64a0
commit 6c406407b2
3 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,7 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read() return open(os.path.join(os.path.dirname(__file__), fname)).read()
args = { args = {
"name":"data-transport", "name":"data-transport",
"version":"1.4.5", "version":"1.4.6",
"author":"The Phi Technology LLC","author_email":"info@the-phi.com", "author":"The Phi Technology LLC","author_email":"info@the-phi.com",
"license":"MIT", "license":"MIT",
"packages":["transport"]} "packages":["transport"]}

View File

@ -164,6 +164,7 @@ def instance(**_args):
e = sqlalchemy.create_engine (uri,future=True) e = sqlalchemy.create_engine (uri,future=True)
args['sqlalchemy'] = e args['sqlalchemy'] = e
# #
# @TODO: Include handling of bigquery with SQLAlchemy # @TODO: Include handling of bigquery with SQLAlchemy
except Exception as e: except Exception as e:

View File

@ -195,7 +195,7 @@ class SQLWriter(SQLRW,Writer):
sql = " ".join(["CREATE TABLE",table," (", ",".join([ name +' '+ self._dtype for name in fields]),")"]) sql = " ".join(["CREATE TABLE",table," (", ",".join([ name +' '+ self._dtype for name in fields]),")"])
else: else:
schema = _args['schema'] if 'schema' in _args else '' schema = _args['schema'] if 'schema' in _args else []
_map = _args['map'] if 'map' in _args else {} _map = _args['map'] if 'map' in _args else {}
sql = [] # ["CREATE TABLE ",_args['table'],"("] sql = [] # ["CREATE TABLE ",_args['table'],"("]
@ -208,7 +208,7 @@ class SQLWriter(SQLRW,Writer):
# table = self._tablename(_args['table']) # table = self._tablename(_args['table'])
sql = ["CREATE TABLE ",table,"( ",sql," )"] sql = ["CREATE TABLE ",table,"( ",sql," )"]
sql = " ".join(sql) sql = " ".join(sql)
# sql = " ".join(["CREATE TABLE",_args['table']," (", ",".join([ schema[i]['name'] +' '+ (schema[i]['type'] if schema[i]['type'] not in _map else _map[schema[i]['type'] ]) for i in range(0,N)]),")"])
cursor = self.conn.cursor() cursor = self.conn.cursor()
try: try:
@ -262,6 +262,7 @@ class SQLWriter(SQLRW,Writer):
return return
SQLRW.lock.acquire() SQLRW.lock.acquire()
if self._engine is not None: if self._engine is not None:
# pd.to_sql(_info,self._engine) # pd.to_sql(_info,self._engine)
if self.schema in ['',None] : if self.schema in ['',None] :