diff --git a/setup.py b/setup.py index ec4edf5..897a57c 100644 --- a/setup.py +++ b/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"]} diff --git a/transport/sql.py b/transport/sql.py index fe29e7b..490f959 100644 --- a/transport/sql.py +++ b/transport/sql.py @@ -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