bug fix: meta data
This commit is contained in:
parent
6b78a82e99
commit
9805264f87
2
setup.py
2
setup.py
|
@ -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"]}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue