From 2eee7261912e25d4e6d0f0cf5ec0ad613abcd5a0 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Fri, 21 Mar 2025 18:23:36 -0500 Subject: [PATCH] bug fix: version update --- info/__init__.py | 2 +- transport/sql/common.py | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/info/__init__.py b/info/__init__.py index 0484b49..7448d70 100644 --- a/info/__init__.py +++ b/info/__init__.py @@ -1,6 +1,6 @@ __app_name__ = 'data-transport' __author__ = 'The Phi Technology' -__version__= '2.4.18' +__version__= '2.4.20' __edition__= 'enterprise' __email__ = "info@the-phi.com" __license__=f""" diff --git a/transport/sql/common.py b/transport/sql/common.py index a75cd1e..ab0e5fd 100644 --- a/transport/sql/common.py +++ b/transport/sql/common.py @@ -56,11 +56,13 @@ class Base: # _map = {'BIGINT':'INTEGER','TEXT':'STRING','DOUBLE_PRECISION':'FLOAT','NUMERIC':'FLOAT','DECIMAL':'FLOAT','REAL':'FLOAT'} # _schema = [{"name":_attr.name,"type":_map.get(str(_attr.type),str(_attr.type))} for _attr in _handler.tables[_table].columns] # - - _inspector = inspect(self._engine) - _columns = _inspector.get_columns(_table) - _schema = [{'name':column['name'],'type':_map.get(str(column['type']),str(column['type'])) } for column in _columns] - return _schema + if _table : + _inspector = inspect(self._engine) + _columns = _inspector.get_columns(_table) + _schema = [{'name':column['name'],'type':_map.get(str(column['type']),str(column['type'])) } for column in _columns] + return _schema + else: + return [] def has(self,**_args): return self.meta(**_args) def apply(self,sql): @@ -74,7 +76,7 @@ class Base: return pd.read_sql(sql,self._engine) else: _handler = self._engine.connect() - _handler.execute(text(sql)) + _handler.execute(text(sql.strip())) _handler.commit () _handler.close() return None @@ -136,7 +138,7 @@ class BaseWriter (SQLBase): super().__init__(**_args) def write(self,_data,**_args): if type(_data) == dict : - _df = pd.DataFrame(_data) + _df = pd.DataFrame([_data]) elif type(_data) == list : _df = pd.DataFrame(_data) else: