Do not initiate sql table when table_query is defined

issue7896
review64491002
This commit is contained in:
Sergi Almacellas Abellana committed 2018-12-03 11:29:43 +01:00
1 parent 131bb3b216
commit fc5f906ce5
1 file changed
+3 -1
+3 -1
View File
@@ -196,7 +196,6 @@ class ModelSQL(ModelStorage):
@classmethod
def __register__(cls, module_name):
sql_table = cls.__table__()
cursor = Transaction().connection.cursor()
TableHandler = backend.get('TableHandler')
super(ModelSQL, cls).__register__(module_name)
@@ -205,6 +204,9 @@ class ModelSQL(ModelStorage):
return
pool = Pool()
# Initiate after the callable test to prevent calling table_query which
# may rely on other model being registered
sql_table = cls.__table__()
# create/update table in the database
table = cls.__table_handler__(module_name)