bug fix: meta data

This commit is contained in:
Steve Nyemba 2022-06-12 20:05:03 -05:00
parent 6b78a82e99
commit 9805264f87
2 changed files with 10 additions and 2 deletions

View File

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

View File

@ -96,7 +96,15 @@ class SQLRW :
self.conn = _handler.connect(**_info)
self._engine = _args['sqlalchemy'] if 'sqlalchemy' in _args else None
def meta(self,**_args):
return []
schema = []
try:
if self._engine :
table = _args['table'] if 'table' in _args else self.table
_m = sqlalchemy.MetaData(bind=self._engine)
schema = [{"name":_attr.name,"type":str(_attr.type)} for _attr in _m.tables[table].columns]
except Exception as e:
e
return schema
def _tablename(self,name) :
return self.schema +'.'+name if self.schema not in [None, ''] and '.' not in name else name