|
|
@ -106,8 +106,13 @@ class SQLRW :
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if self._engine :
|
|
|
|
if self._engine :
|
|
|
|
table = _args['table'] if 'table' in _args else self.table
|
|
|
|
table = _args['table'] if 'table' in _args else self.table
|
|
|
|
|
|
|
|
if sqlalchemy.__version__.startswith('1.') :
|
|
|
|
_m = sqlalchemy.MetaData(bind=self._engine)
|
|
|
|
_m = sqlalchemy.MetaData(bind=self._engine)
|
|
|
|
_m.reflect()
|
|
|
|
_m.reflect()
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_m = sqlalchemy.MetaData()
|
|
|
|
|
|
|
|
_m.reflect(bind=self._engine)
|
|
|
|
schema = [{"name":_attr.name,"type":str(_attr.type)} for _attr in _m.tables[table].columns]
|
|
|
|
schema = [{"name":_attr.name,"type":str(_attr.type)} for _attr in _m.tables[table].columns]
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Some house keeping work
|
|
|
|
# Some house keeping work
|
|
|
@ -117,6 +122,7 @@ class SQLRW :
|
|
|
|
_item['type'] = _m[_item['type']]
|
|
|
|
_item['type'] = _m[_item['type']]
|
|
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
print (e)
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
return schema
|
|
|
|
return schema
|
|
|
|
def _tablename(self,name) :
|
|
|
|
def _tablename(self,name) :
|
|
|
|