From 0a7375b121984979a34046ab5f550f8b03cb37e8 Mon Sep 17 00:00:00 2001 From: signedav Date: Mon, 2 Oct 2023 22:28:13 +0200 Subject: [PATCH] remove unused mssql code and provide proper ignoring a reference to the same layer (because of multi-geometry) --- modelbaker/dataobjects/layers.py | 2 +- modelbaker/dbconnector/mssql_connector.py | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/modelbaker/dataobjects/layers.py b/modelbaker/dataobjects/layers.py index ea6557d..bde6a70 100644 --- a/modelbaker/dataobjects/layers.py +++ b/modelbaker/dataobjects/layers.py @@ -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 ( diff --git a/modelbaker/dbconnector/mssql_connector.py b/modelbaker/dbconnector/mssql_connector.py index f180c0c..48043a6 100644 --- a/modelbaker/dbconnector/mssql_connector.py +++ b/modelbaker/dbconnector/mssql_connector.py @@ -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)