浏览代码

Anpassungen Gerds

gc-server3 10 月之前
父节点
当前提交
32bc55e9f2
共有 3 个文件被更改,包括 5 次插入4 次删除
  1. 3 2
      database/db_create.py
  2. 2 2
      database/model.py
  3. 二进制
      dist/gctools.exe

+ 3 - 2
database/db_create.py

@@ -2,7 +2,8 @@ import json
 from pathlib import Path
 
 import pandas as pd
-from model import DatabaseInspect, create_db_ini, load_config
+
+from database.model import DatabaseInspect, create_db_ini, load_config
 
 
 def get_import_config(filename: str, db_name: str):
@@ -137,7 +138,7 @@ def create(config_file: str = "database/CARLO.json"):
                 f.write(f'  call bcp_in.bat "{table_client}" "[temp].[{current_table["dest"]}]" "{cfg.temp_db}"\n\n')
 
             insert_query = f"INSERT INTO {full_table_name} SELECT * FROM {temp_table_name} T1"
-            pkey = dest_db.get_pkey(current_table["dest"])
+            pkey = dest_db.get_pkey(current_table["dest"], current_table["dest_db"])
             if len(pkey) == 0:
                 print(current_table["dest"] + " hat keinen Primaerschluessel")
                 f.write(f"  rem {current_table['dest']} hat keinen Primaerschluessel")

+ 2 - 2
database/model.py

@@ -129,8 +129,8 @@ class DatabaseInspect:
             source_insp_cols = [len(col[0]) > 0 for col in q.fetchall()]
         return source_insp_cols
 
-    def get_pkey(self, table):
-        source_insp_cols = [col.column_name for col in self.cursor.primaryKeys(table=table)]
+    def get_pkey(self, table, catalog):
+        source_insp_cols = [col.column_name for col in self.cursor.primaryKeys(table=table, catalog=catalog)]
         if len(source_insp_cols) == 0:
             q = self.cursor.execute(
                 "SELECT COLUMN_NAME "

二进制
dist/gctools.exe