Browse Source

refactoring: createAdmTables

refactor
Ulrich 1 year ago
parent
commit
0a5f3dde03
  1. 9
      basic/Testserver.py
  2. 3
      tools/data_tool.py

9
basic/Testserver.py

@ -45,6 +45,7 @@ class Testserver():
Testserver.__instance = self
for s in B.LIST_SUBJECTS:
self.model[tools.data_tool.getSingularKeyword(s)] = model.factory.get_entity_object(job, s, {})
pass
@staticmethod
def getInstance(job):
@ -140,15 +141,17 @@ class Testserver():
except Exception as e:
raise Exception("Fehler bei createSchema "+s)
def createDBTable(self, job, project, compname, tablename):
def createDBTable(self, job, project, context, tablename):
"""
creates a table in the database
:param job:
:return:
"""
args = {}
args["context"] = context
table = model.table.Table(job)
table = table.read_entity(job, tablename)
sql = table.get_schema(project=project, tableName=tablename, tableObject=table) # [B.DATA_NODE_TABLES][m[:-4]]
table = table.read_entity(job, tablename, args=args)
sql = table.get_schema(tablename) # [B.DATA_NODE_TABLES][m[:-4]]
job.m.logInfo(sql)
for s in sql.split(";\n"):
if len(s) < 3:

3
tools/data_tool.py

@ -1,3 +1,4 @@
import basic.constants as B
def getPurKeyword(inkey):
@ -25,6 +26,8 @@ def getPluralKeyword(inkey):
return getPurKeyword(inkey)+"s"
def getSingularKeyword(inkey):
if inkey == "stories":
return B.SUBJECT_STORY
return getPurKeyword(inkey)
def getPluralAttribut(inkey):

Loading…
Cancel
Save