Skip to content

Commit a5e2970

Browse files
author
stephanie
committed
fix schema error
1 parent aea2924 commit a5e2970

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

odm2api/ODM2/models.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,31 +1803,31 @@ class TransectResultValueAnnotations(Base):
18031803
ValueObj = relationship(TransectResultValues)
18041804

18051805

1806-
# def _changeSchema(schema):
1807-
# import inspect
1808-
# import sys
1809-
# #get a list of all of the classes in the module
1810-
# clsmembers = inspect.getmembers(sys.modules[__name__],
1811-
# lambda member: inspect.isclass(member) and member.__module__ == __name__)
1812-
#
1813-
# for name, Tbl in clsmembers:
1814-
# import sqlalchemy.ext.declarative.api as api
1815-
#
1816-
# if isinstance(Tbl, api.DeclarativeMeta):
1817-
# #check to see if the schema is already set correctly
1818-
# if Tbl.__table__.schema ==schema:
1819-
# return
1820-
# Tbl.__table__.schema = schema
1821-
# Tbl.__table_args__["schema"]=schema
1806+
def _changeSchema(schema):
1807+
import inspect
1808+
import sys
1809+
#get a list of all of the classes in the module
1810+
clsmembers = inspect.getmembers(sys.modules[__name__],
1811+
lambda member: inspect.isclass(member) and member.__module__ == __name__)
18221812

1813+
for name, Tbl in clsmembers:
1814+
import sqlalchemy.ext.declarative.api as api
18231815

1824-
def _changeSchema(schema):
1825-
# check to see if the schema is already set correctly
1826-
# if Base.__table__.schema == schema:
1827-
# return
1828-
# Base.__table__.schema = schema
1829-
Base.__table_args__["schema"] = schema
1830-
print schema
1816+
if isinstance(Tbl, api.DeclarativeMeta):
1817+
#check to see if the schema is already set correctly
1818+
if Tbl.__table__.schema ==schema:
1819+
return
1820+
Tbl.__table__.schema = schema
1821+
Tbl.__table_args__["schema"]=schema
1822+
1823+
1824+
# def _changeSchema(schema):
1825+
# # check to see if the schema is already set correctly
1826+
# # if Base.__table__.schema == schema:
1827+
# # return
1828+
# # Base.__table__.schema = schema
1829+
# Base.__table_args__["schema"] = schema
1830+
# print schema
18311831

18321832

18331833
def _getSchema(engine):

0 commit comments

Comments
 (0)