Skip to content

Commit

Permalink
remove unused mssql code and provide proper ignoring a reference to t…
Browse files Browse the repository at this point in the history
…he same layer (because of multi-geometry)
  • Loading branch information
signedav committed Oct 2, 2023
1 parent b09991e commit 0a7375b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion modelbaker/dataobjects/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def post_generate(self, project):
if nm_relation == relation:
continue

if nm_relation.referenced_layer == self:
if nm_relation.referenced_layer.ili_name == self.ili_name:
continue

if (
Expand Down
17 changes: 2 additions & 15 deletions modelbaker/dbconnector/mssql_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,26 +909,13 @@ def get_topics_info(self):
cur.execute(
"""
SELECT DISTINCT PARSENAME(cn.iliname,1) as model,
PARSENAME(cn.iliname,2) as topic,
{relevance}
PARSENAME(cn.iliname,2) as topic
FROM {schema}.t_ili2db_classname as cn
JOIN {schema}.t_ili2db_table_prop as tp
ON cn.sqlname = tp.tablename
WHERE PARSENAME(cn.iliname,3) != '' and tp.setting != 'ENUM'
""".format(
schema=self.schema,
relevance="""
CASE WHEN (WITH children(childTopic, baseTopic) AS (
SELECT substring( thisClass, 1, CHARINDEX('.', substring( thisClass, CHARINDEX('.', thisClass)+1))+CHARINDEX('.', thisClass)-1) as childTopic , substring( baseClass, 1, CHARINDEX('.', substring( baseClass, CHARINDEX('.', baseClass)+1))+CHARINDEX('.', baseClass)-1) as baseTopic
FROM {schema}.T_ILI2DB_INHERITANCE
WHERE substring( baseClass, 1, CHARINDEX('.', substring( baseClass, CHARINDEX('.', baseClass)+1))+CHARINDEX('.', baseClass)-1) = substring( CN.IliName, 1, CHARINDEX('.', substring( CN.IliName, CHARINDEX('.', CN.IliName)+1))+CHARINDEX('.', CN.IliName)-1) -- model.topic
UNION
SELECT substring( inheritance.thisClass, 1, CHARINDEX('.', substring( inheritance.thisClass, CHARINDEX('.', inheritance.thisClass)+1))+CHARINDEX('.', inheritance.thisClass)-1) as childTopic , substring( inheritance.baseClass, 1, CHARINDEX('.', substring( inheritance.baseClass, CHARINDEX('.', baseClass)+1))+CHARINDEX('.', inheritance.baseClass)-1) as baseTopic FROM children
JOIN {schema}.T_ILI2DB_INHERITANCE as inheritance ON substring( inheritance.baseClass, 1, CHARINDEX('.', substring( inheritance.baseClass, CHARINDEX('.', baseClass)+1))+CHARINDEX('.', inheritance.baseClass)-1) = children.childTopic
)SELECT count(childTopic) FROM children)>0 THEN 0 ELSE 1 END AS relevance
""".format(
schema=self.schema
),
schema=self.schema
)
)
result = self._get_dict_result(cur)
Expand Down

0 comments on commit 0a7375b

Please sign in to comment.