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

3
tools/data_tool.py

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

Loading…
Cancel
Save