Kaynağa Gözat

mdl_convert dynamisch ohne einzelne Funktionen

gc-server6 1 yıl önce
ebeveyn
işleme
d4b4be6fad

+ 5 - 0
cognos7/cogtr.py

@@ -0,0 +1,5 @@
+import ctypes
+
+cogtr = ctypes.WinDLL("IBMCognosTransformer.ApplicationCtrl.1")
+
+cogtr.Open("C:\\GlobalCube_LOCOSOFT\\System\\LOCOSOFT\\Models\\s_offene_auftraege.pyj")

+ 164 - 470
cognos7/mdl_convert.py

@@ -3,472 +3,122 @@ from pathlib import Path
 import re
 
 
-id_lookup = {}
-
-
-def get_field(field, block, num=1):
-    if num == 2:
-        res = re.search(field + r' (\d+) "([^"]*)" ', block)
-        if res:
-            return res[1], res[2]
-        return "0", ""
-    res = re.search(field + r' "([^"]*)" ', block)
-    if res:
-        return res[1]
-    res = re.search(field + r" (\w*) ", block)
-    if res:
-        return res[1]
-    return ""
-
-
-def ignore(block):
-    s = block.split(" ")
-    return (s[0], block)
-
-
-def model_name(block):
-    return {
-        "Type": "ModelName",
-        "Name": get_field("Name", block),
-        "ModelCodePage": get_field("ModelCodePage", block),
-        "AutoAccess": get_field("AutoAccess", block),
-        "UpdateCycle": get_field("UpdateCycle", block),
-        "ModelStamp": get_field("ModelStamp", block),
-        "Version": get_field("Version", block),
-        "ModelCategoryOrderDefault": get_field("ModelCategoryOrderDefault", block),
-        "ModelOrderedByDefault": get_field("ModelOrderedByDefault", block),
-        "ModelNonRollupHierarchies": get_field("ModelNonRollupHierarchies", block),
-    }
-
-
-def cognos_source(block):
-    id, name = get_field("CognosSource", block, 2)
-    return {
-        "Type": "CognosSource",
-        "ID": id,
-        "Name": name,
-        "SourceType": get_field("SourceType", block),
-        "SourcePath": get_field("SourcePath", block),
-        "PackageTimeStamp": get_field("PackageTimeStamp", block),
-    }
-
-
-def cognos_package_datasource_connection(block):
-    id, name = get_field("CognosPackageDatasourceConnection", block, 2)
-    prs_id, prs_name = get_field("PackageReportSource", block, 2)
-    return {
-        "Type": "CognosPackageDatasourceConnection",
-        "ID": id,
-        "Name": name,
-        "PackageReportSource": {
-            "ID": prs_id,
-            "Name": prs_name,
-        },
-        "CognosPackageConnection": get_field("CognosPackageConnection", block),
-        "CognosPackageConnectionSignon": get_field(
-            "CognosPackageConnectionSignon", block
-        ),
-        "CognosPackageAlwaysUseTransformerSignon": get_field(
-            "CognosPackageAlwaysUseTransformerSignon", block
-        ),
-        "CognosPackagePowercubeSource": get_field(
-            "CognosPackagePowercubeSource", block
-        ),
-    }
-
-
-def data_source(block):
-    id, name = get_field("DataSource", block, 2)
-    prs_id, prs_name = get_field("PackageReportSource", block, 2)
-    return {
-        "Type": "DataSource",
-        "ID": id,
-        "Name": name,
-        "Separator": get_field("Separator", block),
-        "SourceType": get_field("SourceType", block),
-        "CharacterSet": get_field("CharacterSet", block),
-        "DecimalSep": get_field("DecimalSep", block),
-        "Thousandsep": get_field("Thousandsep", block),
-        "HasColumns": get_field("Columns", block),
-        "Timing": get_field("Timing", block),
-        "PackageReportSource": {
-            "ID": prs_id,
-            "Name": prs_name,
-        },
-        "AutoSummary": get_field("AutoSummary", block),
-        "SetCurrent": get_field("SetCurrent", block),
-        "ServerSource": get_field("ServerSource", block),
-        "Speed": get_field("Speed", block),
-        "Presummarized": get_field("Presummarized", block),
-        "StreamExtractSize": get_field("StreamExtractSize", block),
-        "Columns": [],
-    }
-
-
-def org_name(block):
-    id, name = get_field("OrgName", block, 2)
-    return {
-        "Type": "OrgName",
-        "ID": id,
-        "Name": name,
-        "Origin": get_field("Origin", block),
-        "Offset": get_field("Offset", block),
-        "Column": get_field("Column", block),
-        "Storage": get_field("Storage", block),
-        "Scale": get_field("Scale", block),
-        "Size": get_field("Size", block),
-        "Decimals": get_field("Decimals", block),
-        "Class": get_field("Class", block),
-        "InputScale": get_field("InputScale", block),
-        "TimeArray": get_field("TimeArray", block),
-        "ColSrcType": get_field("ColSrcType", block),
-        "Associations": [],
-    }
-
-
-def dimension(block):
-    id, name = get_field("Dimension", block, 2)
-    return {
-        "Type": "Dimension",
-        "ID": id,
-        "Name": name,
-        "DimType": get_field("DimType", block),
-        "EarliestDate": get_field("EarliestDate", block),
-        "LatestDate": get_field("LatestDate", block),
-        "ManualPeriods": get_field("ManualPeriods", block),
-        "DaysInWeek": get_field("DaysInWeek", block),
-        "NewCatsLock": get_field("NewCatsLock", block),
-        "ExcludeAutoPartitioning": get_field("ExcludeAutoPartitioning", block),
-        "DimDefaultCategory": get_field("DimDefaultCategory", block),
-        "Root": {},
-        "Levels": [],
-        "Categories": [],
-        "SpecialCategories": [],
-    }
-
-
-def root(block):
-    id, name = get_field("Root", block, 2)
-    return {
-        "Type": "Root",
-        "ID": id,
-        "Name": name,
-        "Inclusion": get_field("Inclusion", block),
-        "Lastuse": get_field("Lastuse", block),
-        "Date": get_field("Date", block),
-        "Filtered": get_field("Filtered", block),
-        "Suppressed": get_field("Suppressed", block),
-        "Sign": get_field("Sign", block),
-        "HideValue": get_field("HideValue", block),
-        "IsKeyOrphanage": get_field("IsKeyOrphanage", block),
-        "IsTruncated": get_field("IsTruncated", block),
-        "Blanks": get_field("Blanks", block),
-        "Drill": {},
-    }
-
-
-def levels(block):
-    id, name = get_field("Levels", block, 2)
-    return {
-        "Type": "Levels",
-        "ID": id,
-        "Name": name,
-        "Blanks": get_field("Blanks", block),
-        "Inclusion": get_field("Inclusion", block),
-        "DateFunction": get_field("DateFunction", block),
-        "Generate": get_field("Generate", block),
-        "RefreshLabel": get_field("RefreshLabel", block),
-        "RefreshDescription": get_field("RefreshDescription", block),
-        "RefreshShortName": get_field("RefreshShortName", block),
-        "NewCatsLock": get_field("NewCatsLock", block),
-        "CatLabFormat": get_field("CatLabFormat", block),
-        "Timerank": get_field("Timerank", block),
-        "UniqueCategories": get_field("UniqueCategories", block),
-        "UniqueMove": get_field("UniqueMove", block),
-        "Associations": [],
-    }
-
-
-def category(block):
-    id, name = get_field("Category", block, 2)
-    return {
-        "Type": "Category",
-        "ID": id,
-        "Name": name,
-        "Parent": get_field("Parent", block),
-        "Levels": get_field("Levels", block),
-        "OrderBy": get_field("OrderBy", block),
-        "Value": get_field("Value", block),
-        "Label": get_field("Label", block),
-        "Lastuse": get_field("Lastuse", block),
-        "SourceValue": get_field("SourceValue", block),
-        "Date": get_field("Date", block),
-        "Filtered": get_field("Filtered", block),
-        "Suppressed": get_field("Suppressed", block),
-        "Sign": get_field("Sign", block),
-        "HideValue": get_field("HideValue", block),
-        "IsKeyOrphanage": get_field("IsKeyOrphanage", block),
-        "IsTruncated": get_field("IsTruncated", block),
-        "Blanks": get_field("Blanks", block),
-    }
-
-
-def special_category(block):
-    id, name = get_field("SpecialCategory", block, 2)
-    return {
-        "Type": "SpecialCategory",
-        "ID": id,
-        "Name": name,
-        "Parent": get_field("Parent", block),
-        "Levels": get_field("Levels", block),
-        "Lastuse": get_field("Lastuse", block),
-        "Rollup": get_field("Rollup", block),
-        "TimeAggregate": get_field("TimeAggregate", block),
-        "RunningPeriods": get_field("RunningPeriods", block),
-        "TargetOffset": get_field("TargetOffset", block),
-        "TargetLevel": get_field("TargetLevel", block),
-        "ContextOffset": get_field("ContextOffset", block),
-        "DateDrill": get_field("DateDrill", block),
-        "Primary": get_field("Primary", block),
-        "Sign": get_field("Sign", block),
-    }
-
-
-def map_drills(block):
-    return {
-        "Type": "MapDrills",
-        # "MapDrills MapDrill 1469 "
-    }
-
-
-def view_name(block):
-    id, name = get_field("ViewName", block, 2)
-    return {
-        "Type": "ViewName",
-        "ID": id,
-        "Name": name,
-        "ViewType": get_field("Type", block),
-        "ViewCustomView": get_field("ViewCustomView", block),
-    }
-
-
-def associations(block):
-    id, name = get_field("Associations", block, 2)
-    return {
-        "Type": "Associations",
-        "ID": id,
-        "Name": name,
-        "AssociationType": get_field("AssociationType", block),
-        "AssociationRole": get_field("AssociationRole", block),
-        "AssociationReferenced": get_field("AssociationReferenced", block),
-        "SortOrder": get_field("SortOrder", block),
-        "SortAs": get_field("SortAs", block),
-        "Parent": "0",
-    }
-
-
-def drill(block):
-    id, name = get_field("Drill", block, 2)
-    return {
-        "Type": "Drill",
-        "ID": id,
-        "Name": name,
-        "Label": get_field("Label", block),
-        "Inclusion": get_field("Inclusion", block),
-        "Filtered": get_field("Filtered", block),
-        "Suppressed": get_field("Suppressed", block),
-        "PrimaryDrill": get_field("PrimaryDrill", block),
-        "HideValue": get_field("HideValue", block),
-        "YearBegins": get_field("YearBegins", block),
-        "PartialWeek": get_field("PartialWeek", block),
-        "ExtraWeek": get_field("ExtraWeek", block),
-        "WeekBegins": get_field("WeekBegins", block),
-    }
-
-
-def measure(block):
-    id, name = get_field("Measure", block, 2)
-    return {
-        "Type": "Measure",
-        "ID": id,
-        "Name": name,
-        "Missing": get_field("Missing", block),
-        "IgnoreMissingValue": get_field("IgnoreMissingValue", block),
-        "Storage": get_field("Storage", block),
-        "OutPutScale": get_field("OutPutScale", block),
-        "Decimals": get_field("Decimals", block),
-        "ReverseSign": get_field("ReverseSign", block),
-        "IsCurrency": get_field("IsCurrency", block),
-        "IsFolder": get_field("IsFolder", block),
-        "Format": get_field("Format", block),
-        "DrillThrough": get_field("DrillThrough", block),
-        "Associations": [],
-    }
-
-
-def signon(block):
-    id, name = get_field("Signon", block, 2)
-    return {
-        "Type": "Signon",
-        "ID": id,
-        "Name": name,
-        "UserId": get_field("UserId", block),
-        "PromptForPassword": get_field("PromptForPassword", block),
-        "EncryptedPW": get_field("EncryptedPW", block),
-        "AutoLogon": get_field("AutoLogon", block),
-        "SignonType": get_field("SignonType", block),
-    }
-
-
-def dimension_view(block):
-    id, name = get_field("DimensionView", block, 2)
-    return {
-        "Type": "DimensionView",
-        "ID": id,
-        "Name": name
-        # "DimensionView 1463 \"All Categories\" DimensionView 1521 \"All Categories\" DimensionView 1551 \"All Categories\"
-        # DimensionView 1575 \"All Categories\" DimensionView 1591 \"All Categories\" DimensionView 1651 \"All Categories\"
-        # DimensionView 1665 \"All Categories\" DimensionView 1693 \"All Categories\" DimensionView 15741 \"All Categories\"
-        # MeasureInclude 9829 Yes MeasureInclude 10053 Yes MeasureInclude 10309 Yes MeasureInclude 10313 Yes
-        # MeasureInclude 10317 Yes MeasureInclude 15761 Yes "
-    }
-
-
-def allocation_add(block):
-    # only in DimensionView
-    return {
-        "Type": "AllocationAdd",
-        # "AllocationAdd Measure 9829 Type Default AllocationAdd Measure 10053 Type Default AllocationAdd Measure 10309 Type Default
-        # AllocationAdd Measure 10313 Type Default AllocationAdd Measure 10317 Type Default AllocationAdd Measure 15761 Type Default "
-    }
-
-
-def cube(block):
-    id, name = get_field("Cube", block, 2)
-    return {
-        "Type": "Cube",
-        "ID": id,
-        "Name": name,
-        "MdcFile": get_field("MdcFile", block),
-        "EncryptedPW": get_field("EncryptedPW", block),
-        "Status": get_field("Status", block),
-        "CubeCreation": get_field("CubeCreation", block),
-        "Optimize": get_field("Optimize", block),
-        "ConsolidatedRecords": get_field("ConsolidatedRecords", block),
-        "PartitionSize": get_field("PartitionSize", block),
-        "PassesNumber": get_field("PassesNumber", block),
-        "Compress": get_field("Compress", block),
-        "IncrementalUpdate": get_field("IncrementalUpdate", block),
-        "ServerCube": get_field("ServerCube", block),
-        "CubeStamp": get_field("CubeStamp", block),
-        "CubeCycle": get_field("CubeCycle", block),
-        "BlockParentTotals": get_field("BlockParentTotals", block),
-        "Caching": get_field("Caching", block),
-        "UseAlternateFileName": get_field("UseAlternateFileName", block),
-        "DeployType": get_field("DeployType", block),
-        "DeployLocations": get_field("DeployLocations", block),
-        "DeployToAvailableLocationsAutomatic": get_field(
-            "DeployToAvailableLocationsAutomatic", block
-        ),
-        "DeployCleanupEnabled": get_field("DeployCleanupEnabled", block),
-        "DeployCleanupNumberOfCubes": get_field("DeployCleanupNumberOfCubes", block),
-        "DrillThrough": get_field("DrillThrough", block),
-        "DataSourceSignon": get_field("DataSourceSignon", block),
-        "PublishEnable": get_field("PublishEnable", block),
-        "PublishStatus": get_field("PublishStatus", block),
-        "PublishAllowNullSuppression": get_field("PublishAllowNullSuppression", block),
-        "PublishAllowMultiEdgeSuppression": get_field(
-            "PublishAllowMultiEdgeSuppression", block
-        ),
-        "PublishAllowAccessToSuppressionOptions": get_field(
-            "PublishAllowAccessToSuppressionOptions", block
-        ),
-    }
-
-
-def custom_view(block):
-    id, name = get_field("CustomView", block, 2)
-    return {
-        "Type": "CustomView",
-        "ID": id,
-        "Name": name,
-        "DimensionView": [
-            {"ID": b[0], "Name": b[1]}
-            for b in re.findall(r'DimensionView (\d+) "([^"]+)"', block)
-        ],
-        "MeasureInclude": [
-            {"ID": b[0], "Name": b[1]}
-            for b in re.findall(r"MeasureInclude (\d+) (\w+) ", block)
-        ],
-        "ChildList": {},
-    }
-
-
-def custom_view_child_list(block):
-    id, name = get_field("CustomViewChildList", block, 2)
-    return {
-        "Type": "CustomViewChildList",
-        "ID": id,
-        "Name": name,
-    }
-
-
-def security_namespace(block):
-    id, name = get_field("SecurityNameSpace", block, 2)
-    return {
-        "Type": "SecurityNameSpace",
-        "ID": id,
-        "Name": name,
-        "SecurityNameSpaceCAMID": get_field("SecurityNameSpaceCAMID", block),
-        "Objects": [],
-    }
-
-
-def security_object(block):
-    id, name = get_field("SecurityObject", block, 2)
-    return {
-        "Type": "SecurityObject",
-        "ID": id,
-        "Name": name,
-        "SecurityObjectDisplayName": get_field("SecurityObjectDisplayName", block),
-        "SecurityObjectType": get_field("SecurityObjectType", block),
-        "CustomViewList": get_field("CustomViewList", block),
-    }
-
+CONVERSION = [
+    "Name",
+    "CognosSource",
+    "CognosPackageDatasourceConnection",
+    "DataSource",
+    "OrgName",
+    "Dimension",
+    "Root",
+    "Drill",
+    "Levels",
+    "Associations",
+    "Category",
+    "SpecialCategory",
+    "MapDrills",
+    "ViewName",
+    "Measure",
+    "Signon",
+    "Cube",
+    "CustomView",
+    "CustomViewChildList",
+    "SecurityNameSpace",
+    "SecurityObject",
+]
 
-CONVERSION = {
-    "Name": model_name,
-    "CognosSource": cognos_source,
-    "CognosPackageDatasourceConnection": cognos_package_datasource_connection,
-    "DataSource": data_source,
-    "OrgName": org_name,
-    "Dimension": dimension,
-    "Root": root,
-    "Drill": drill,
-    "Levels": levels,
-    "Associations": associations,
-    "Category": category,
-    "SpecialCategory": special_category,
-    "MapDrills": map_drills,
-    "ViewName": view_name,
-    "Measure": measure,
-    "Signon": signon,
-    "Cube": cube,
-    "CustomView": custom_view,
-    "CustomViewChildList": custom_view_child_list,
-    "SecurityNameSpace": security_namespace,
-    "SecurityObject": security_object,
-}
+id_lookup = {}
+find_words = re.compile(r'("[^"]+"|\w+) ')
 
 
 def convert_block(block):
     block = block.replace("\n", "")
     block_type = block.split(" ")[0]
-    # block_pair = re.findall(r'("[^"]+"|\w+) ', block)
-    # return (block_type, list(zip((block_pair[::2], block_pair[1::2]))))
-    if block_type in CONVERSION:
-        return CONVERSION[block_type](block)
-    return {"Type": block_type}
+
+    words = find_words.findall(block)
+    if len(words) < 3:
+        return {"Type": block_type}
+    result = {"Type": words[0], "ID": words[1], "Name": words[2].strip('"')}
+
+    offset = 0
+    for i in range(3, len(words), 2):
+        if len(words) < i + offset + 2:
+            break
+        key = words[i + offset]
+        if key in ["PackageReportSource", "Database"]:
+            result[key] = {
+                "ID": words[i + offset + 1],
+                "Name": words[i + offset + 2].strip('"'),
+            }
+            offset += 1
+        elif key in ["DimensionView"]:
+            if key + "s" not in result:
+                result[key + "s"] = []
+            result[key + "s"].append(
+                {"ID": words[i + offset + 1], "Name": words[i + offset + 2].strip('"')}
+            )
+            offset += 1
+        elif key in ["MeasureInclude"]:
+            if key + "s" not in result:
+                result[key + "s"] = []
+            result[key + "s"].append(
+                {"ID": words[i + offset + 1], "Include": words[i + offset + 2]}
+            )
+            offset += 1
+        elif key == "Calc":
+            for j in range(i + offset + 1, len(words)):
+                if words[j] in ["Sign", "Format", "Filtered"] or j == len(words) - 1:
+                    result["Calc"] = " ".join(words[i + offset + 1 : j])
+                    offset = j - i - 1
+                    break  # for
+        elif key == "EncryptedPW":
+            result["EncryptedPW"] = words[i + offset + 1].strip('"')
+            result["Salt"] = words[i + offset + 2].strip('"')
+            offset += 1
+        elif key == "AllocationAdd":
+            if key + "s" not in result:
+                result[key + "s"] = []
+            result[key + "s"].append(
+                {"Measure": words[i + offset + 2], "Type": words[i + offset + 4]}
+            )
+            offset += 3
+        elif key in [
+            "CustomViewList",
+            "DrillThrough",
+            "DeployLocations",
+            "PowerCubeCustomViewList",
+            "StartList",
+            "TransientLevelList",
+        ]:
+            for j in range(i + offset + 1, len(words)):
+                if words[j] in ["EndList"]:
+                    result[key] = " ".join(words[i + offset + 1 : j])
+                    offset = j - i - 1
+                    break  # for
+        # elif words[i + offset].isnumeric() or words[i + offset].startswith('"'):
+        #    offset += 1
+        else:
+            result[key] = words[i + offset + 1].strip('"')
+
+    if block_type == "DataSource":
+        result["Columns"] = []
+    if block_type in ["OrgName", "Levels", "Measure"]:
+        result["Associations"] = []
+    if block_type == "Dimension":
+        result["Root"] = {}
+        result["Levels"] = []
+        result["Categories"] = []
+        result["SpecialCategories"] = []
+    if block_type == "Root":
+        result["Drill"] = {}
+    if block_type == "Associations":
+        result["Parent"] = 0
+    if block_type == "CustomView":
+        result["ChildList"] = {}
+    if block_type == "SecurityNameSpace":
+        result["Objects"] = []
+
+    return result
 
 
 def remove_ids(nested):
@@ -476,6 +126,14 @@ def remove_ids(nested):
     nested.pop("DateDrill", "")
     nested.pop("Primary", "")
     nested.pop("Lastuse", "")
+    nested.pop("AssociationContext", "")
+    if (
+        nested.get("Type", "") == "SpecialCategory"
+        and "Label" in nested
+        and "20" in nested["Label"]
+    ):
+        nested.pop("Label", "")
+
     for col in ["Parent", "Levels", "CustomViewList"]:
         if col not in nested:
             continue
@@ -494,20 +152,19 @@ def remove_ids(nested):
     return nested
 
 
-def convert_file(filename):
-    with open(filename, "r", encoding="latin-1") as frh:
-        mdl_str = frh.read()
-
+def prepare_mdl_str(mdl_str):
     mdl_str = re.sub(r"\n+", "\n", mdl_str)
+    mdl_str = re.sub(r"^\n?Name ", "ModelName 1 ", mdl_str)
     mdl_str = re.sub(r'\nLevels (\d+ [^"])', r"Levels \1", mdl_str)
     mdl_str = re.sub(r" Associations ", " \nAssociations ", mdl_str)
     mdl_str = re.sub(r'([^ ])""', r"\1'", mdl_str)
     mdl_str = re.sub(r'""([^ ])', r"'\1", mdl_str)
-    tags = "|".join(list(CONVERSION.keys()))
+    tags = "|".join(CONVERSION)
     mdl_str = re.sub(r"\n(" + tags + r") ", r"\n\n\1 ", mdl_str)
-    mdl_blocks = mdl_str.split("\n\n")
+    return mdl_str
 
-    converted = [convert_block(b) for b in mdl_blocks]
+
+def group_mdl_blocks(converted):
     result = {
         "Model": {},
         "Connections": [],
@@ -587,12 +244,49 @@ def convert_file(filename):
             result["Security"][-1]["Objects"].append(c)
         # else:
         #     print(t, c)
+    return result
+
+
+def build_query(datasource):
+    table = datasource["Name"]
+    suffix = "_fm" if datasource["SourceType"] == "CognosSourceQuery" else "_imr"
+    table_name = f"[staging].[{table}{suffix}]"
+    view_name = f"[load].[{table}]"
+    columns = ",\n    ".join([extract_column(c) for c in datasource["Columns"]])
+    return f"CREATE VIEW {view_name}\nAS\nSELECT {columns} \nFROM {table_name}\nGO\n\n"
+
 
-    json.dump(result, open(filename[:-4] + "_ori.json", "w"), indent=2)
+def extract_column(col):
+    name = col["Name"]
+    if "]." in name:
+        name = name.split("].")[-1]
+    alias = col["Column"]
+    is_used = "" if len(col["Associations"]) > 0 else "--"
+    return f'{is_used}{name} AS "{alias}"'
+
+
+def convert_file(filename):
+    with open(filename, "r", encoding="latin-1") as frh:
+        mdl_str = frh.read()
+
+    mdl_str = prepare_mdl_str(mdl_str)
+    mdl_blocks = mdl_str.split("\n\n")
+
+    converted = [convert_block(b) for b in mdl_blocks]
+
+    grouped = group_mdl_blocks(converted)
+
+    with open(filename[:-4] + "_ori.json", "w") as fwh:
+        json.dump(grouped, fwh, indent=2)
     # yaml.safe_dump(result, open(filename[:-4] + ".yaml", "w"))
 
-    result = remove_ids(result)
-    json.dump(result, open(filename[:-4] + ".json", "w"), indent=2)
+    without_ids = remove_ids(grouped)
+    with open(filename[:-4] + ".json", "w") as fwh:
+        json.dump(without_ids, fwh, indent=2)
+
+    queries = [build_query(ds) for ds in grouped["DataSources"]]
+    with open(filename[:-4] + "_queries.txt", "w", encoding="latin-1") as fwh:
+        fwh.writelines(queries)
 
 
 def convert_folder(base_dir):

Dosya farkı çok büyük olduğundan ihmal edildi
+ 55 - 225
data/F_Belege_SKR_SKR_Boettche.json


+ 615 - 0
data/F_Belege_SKR_SKR_Boettche_queries.txt

@@ -0,0 +1,615 @@
+CREATE VIEW [load].[current_date_Prognose]
+AS
+SELECT --[Bundeslaender Id] AS "Bundeslaender Id",
+    [Invoice Date] AS "Bookkeep Date",
+    --[Wochentage Id] AS "Wochentage Id",
+    --[Arbeitstag Mofr] AS "Arbeitstag Mofr",
+    [Zaehler Mofr] AS "Zaehler Mofr",
+    [Summe Mofr] AS "Summe Mofr",
+    --[Arbeitstag Mosa] AS "Arbeitstag Mosa",
+    --[Zaehler Mosa] AS "Zaehler Mosa",
+    --[Summe Mosa] AS "Summe Mosa",
+    --[Feiertage Id] AS "Feiertage Id",
+    --[Jahr] AS "Jahr",
+    [Arbeitstag Nr Jahr] AS "Arbeitstag Nr Jahr",
+    [Gesamt Arbeitstage] AS "Gesamt Arbeitstage",
+    Monat_Belege AS "Monat_Belege" 
+FROM [staging].[current_date_Prognose_fm]
+GO
+
+CREATE VIEW [load].[Kontenrahmen]
+AS
+SELECT --[Konto_Nr] AS "Konto_Nr",
+    --[Konto_Bezeichnung] AS "Konto_Bezeichnung",
+    --[Konto_Art] AS "Konto_Art",
+    --[Kostenstelle] AS "Kostenstelle",
+    --[STK] AS "STK",
+    --[Konto_1] AS "Konto_1",
+    --[Konto_2] AS "Konto_2",
+    --[Konto_3] AS "Konto_3",
+    --[Konto_4] AS "Konto_4",
+    --[Konto_5] AS "Konto_5",
+    --[Ebene1] AS "Ebene1",
+    --[Ebene2] AS "Ebene2",
+    --[Ebene3] AS "Ebene3",
+    --[Ebene4] AS "Ebene4",
+    --[Ebene5] AS "Ebene5",
+    --[Ebene6] AS "Ebene6",
+    --[Ebene7] AS "Ebene7",
+    --[Ebene8] AS "Ebene8",
+    --[Ebene9] AS "Ebene9",
+    --[Ebene10] AS "Ebene10",
+    [Ebene11] AS "Ebene11",
+    --[Ebene12] AS "Ebene12",
+    --[Ebene13] AS "Ebene13",
+    --[Ebene14] AS "Ebene14",
+    --[Ebene15] AS "Ebene15",
+    --[Ebene16] AS "Ebene16",
+    --[Ebene17] AS "Ebene17",
+    --[Ebene18] AS "Ebene18",
+    --[Ebene19] AS "Ebene19",
+    --[Ebene20] AS "Ebene20",
+    [Ebene21] AS "Ebene21",
+    --[Ebene22] AS "Ebene22",
+    --[Ebene23] AS "Ebene23",
+    --[Ebene24] AS "Ebene24",
+    --[Ebene25] AS "Ebene25",
+    --[Ebene26] AS "Ebene26",
+    --[Ebene27] AS "Ebene27",
+    --[Ebene28] AS "Ebene28",
+    --[Ebene29] AS "Ebene29",
+    --[Ebene30] AS "Ebene30",
+    [Ebene31] AS "Ebene31",
+    --[Ebene32] AS "Ebene32",
+    --[Ebene33] AS "Ebene33",
+    --[Ebene34] AS "Ebene34",
+    --[Ebene35] AS "Ebene35",
+    --[Ebene36] AS "Ebene36",
+    --[Ebene37] AS "Ebene37",
+    --[Ebene38] AS "Ebene38",
+    --[Ebene39] AS "Ebene39",
+    --[Ebene40] AS "Ebene40",
+    --[Ebene41] AS "Ebene41",
+    --[Ebene42] AS "Ebene42",
+    --[Ebene43] AS "Ebene43",
+    --[Ebene44] AS "Ebene44",
+    --[Ebene45] AS "Ebene45",
+    --[Ebene46] AS "Ebene46",
+    --[Ebene47] AS "Ebene47",
+    --[Ebene48] AS "Ebene48",
+    --[Ebene49] AS "Ebene49",
+    --[Ebene50] AS "Ebene50",
+    [Ebene51] AS "Ebene51",
+    [Ebene52] AS "Ebene52",
+    [Ebene53] AS "Ebene53",
+    [Ebene54] AS "Ebene54",
+    [Ebene55] AS "Ebene55",
+    [Ebene56] AS "Ebene56",
+    --[Ebene57] AS "Ebene57",
+    --[Ebene58] AS "Ebene58",
+    --[Ebene59] AS "Ebene59",
+    --[Ebene60] AS "Ebene60",
+    [Ebene61] AS "Ebene61",
+    [Ebene62] AS "Ebene62",
+    [Ebene63] AS "Ebene63",
+    [Ebene64] AS "Ebene64",
+    [Ebene65] AS "Ebene65",
+    [Ebene66] AS "Ebene66",
+    --[Ebene67] AS "Ebene67",
+    --[Ebene68] AS "Ebene68",
+    --[Ebene69] AS "Ebene69",
+    --[Ebene70] AS "Ebene70" 
+FROM [staging].[Kontenrahmen_fm]
+GO
+
+CREATE VIEW [load].[Kontenrahmen_GC_Struct_SKR]
+AS
+SELECT --[Konto Nr] AS "Konto Nr",
+    --[Konto Bezeichnung] AS "Konto Bezeichnung",
+    --[Konto Art_ori] AS "Konto Art_ori",
+    --[Kostenstelle] AS "Kostenstelle",
+    --[Stk] AS "Stk",
+    --[Konto 1] AS "Konto 1",
+    --[Konto 2] AS "Konto 2",
+    --[Konto 3] AS "Konto 3",
+    --[Konto 4] AS "Konto 4",
+    --[Konto 5] AS "Konto 5",
+    --[Ebene1] AS "Ebene1",
+    --[Ebene2] AS "Ebene2",
+    --[Ebene3] AS "Ebene3",
+    --[Ebene4] AS "Ebene4",
+    --[Ebene5] AS "Ebene5",
+    --[Ebene6] AS "Ebene6",
+    --[Ebene7] AS "Ebene7",
+    --[Ebene8] AS "Ebene8",
+    --[Ebene9] AS "Ebene9",
+    --[Ebene10] AS "Ebene10",
+    [Ebene11] AS "Ebene11",
+    --[Ebene12] AS "Ebene12",
+    --[Ebene13] AS "Ebene13",
+    --[Ebene14] AS "Ebene14",
+    --[Ebene15] AS "Ebene15",
+    --[Ebene16] AS "Ebene16",
+    --[Ebene17] AS "Ebene17",
+    --[Ebene18] AS "Ebene18",
+    --[Ebene19] AS "Ebene19",
+    --[Ebene20] AS "Ebene20",
+    [Ebene21] AS "Ebene21",
+    --[Ebene22] AS "Ebene22",
+    --[Ebene23] AS "Ebene23",
+    --[Ebene24] AS "Ebene24",
+    --[Ebene25] AS "Ebene25",
+    --[Ebene26] AS "Ebene26",
+    --[Ebene27] AS "Ebene27",
+    --[Ebene28] AS "Ebene28",
+    --[Ebene29] AS "Ebene29",
+    --[Ebene30] AS "Ebene30",
+    [Ebene31] AS "Ebene31",
+    --[Ebene32] AS "Ebene32",
+    --[Ebene33] AS "Ebene33",
+    --[Ebene34] AS "Ebene34",
+    --[Ebene35] AS "Ebene35",
+    --[Ebene36] AS "Ebene36",
+    --[Ebene37] AS "Ebene37",
+    --[Ebene38] AS "Ebene38",
+    --[Ebene39] AS "Ebene39",
+    --[Ebene40] AS "Ebene40",
+    --[Ebene41] AS "Ebene41",
+    --[Ebene42] AS "Ebene42",
+    --[Ebene43] AS "Ebene43",
+    --[Ebene44] AS "Ebene44",
+    --[Ebene45] AS "Ebene45",
+    --[Ebene46] AS "Ebene46",
+    --[Ebene47] AS "Ebene47",
+    --[Ebene48] AS "Ebene48",
+    --[Ebene49] AS "Ebene49",
+    --[Ebene50] AS "Ebene50",
+    [Ebene51] AS "Ebene51",
+    [Ebene52] AS "Ebene52",
+    [Ebene53] AS "Ebene53",
+    [Ebene54] AS "Ebene54",
+    [Ebene55] AS "Ebene55",
+    [Ebene56] AS "Ebene56",
+    --[Ebene57] AS "Ebene57",
+    --[Ebene58] AS "Ebene58",
+    --[Ebene59] AS "Ebene59",
+    --[Ebene60] AS "Ebene60",
+    [Ebene61] AS "Ebene61",
+    [Ebene62] AS "Ebene62",
+    [Ebene63] AS "Ebene63",
+    [Ebene64] AS "Ebene64",
+    [Ebene65] AS "Ebene65",
+    [Ebene66] AS "Ebene66",
+    --[Ebene67] AS "Ebene67",
+    --[Ebene68] AS "Ebene68",
+    --[Ebene69] AS "Ebene69",
+    --[Ebene70] AS "Ebene70",
+    [Ebene71] AS "Ebene71",
+    [Ebene72] AS "Ebene72",
+    [Ebene73] AS "Ebene73",
+    [Ebene74] AS "Ebene74",
+    [Ebene75] AS "Ebene75",
+    [Ebene76] AS "Ebene76",
+    [Ebene77] AS "Ebene77",
+    --[Ebene78] AS "Ebene78",
+    --[Ebene79] AS "Ebene79",
+    --[Ebene80] AS "Ebene80",
+    --[Anzahl Stellen_Konto_Nr] AS "Anzahl Stellen_Konto_Nr",
+    --[Konto Art] AS "Konto Art",
+    [GuV_Bilanz] AS "GuV_Bilanz",
+    [Acct Nr] AS "Acct Nr",
+    [Konto] AS "Konto",
+    [Susa] AS "Susa" 
+FROM [staging].[Kontenrahmen_GC_Struct_SKR_fm]
+GO
+
+CREATE VIEW [load].[Kontenrahmen_KST_90]
+AS
+SELECT --[Konto_Nr] AS "Konto_Nr",
+    --[_90] AS "_90",
+    [Acct Nr] AS "Acct Nr",
+    --[Konto_Bezeichnung] AS "Konto_Bezeichnung",
+    --[Konto_Art] AS "Konto_Art",
+    --[Kostenstelle] AS "Kostenstelle",
+    --[STK] AS "STK",
+    --[Konto_1] AS "Konto_1",
+    --[Konto_2] AS "Konto_2",
+    --[Konto_3] AS "Konto_3",
+    --[Konto_4] AS "Konto_4",
+    --[Konto_5] AS "Konto_5",
+    --[Ebene1] AS "Ebene1",
+    --[Ebene2] AS "Ebene2",
+    --[Ebene3] AS "Ebene3",
+    --[Ebene4] AS "Ebene4",
+    --[Ebene5] AS "Ebene5",
+    --[Ebene6] AS "Ebene6",
+    --[Ebene7] AS "Ebene7",
+    --[Ebene8] AS "Ebene8",
+    --[Ebene9] AS "Ebene9",
+    --[Ebene10] AS "Ebene10",
+    [Ebene11] AS "Ebene11",
+    --[Ebene12] AS "Ebene12",
+    --[Ebene13] AS "Ebene13",
+    --[Ebene14] AS "Ebene14",
+    --[Ebene15] AS "Ebene15",
+    --[Ebene16] AS "Ebene16",
+    --[Ebene17] AS "Ebene17",
+    --[Ebene18] AS "Ebene18",
+    --[Ebene19] AS "Ebene19",
+    --[Ebene20] AS "Ebene20",
+    [Ebene21] AS "Ebene21",
+    --[Ebene22] AS "Ebene22",
+    --[Ebene23] AS "Ebene23",
+    --[Ebene24] AS "Ebene24",
+    --[Ebene25] AS "Ebene25",
+    --[Ebene26] AS "Ebene26",
+    --[Ebene27] AS "Ebene27",
+    --[Ebene28] AS "Ebene28",
+    --[Ebene29] AS "Ebene29",
+    --[Ebene30] AS "Ebene30",
+    [Ebene31] AS "Ebene31",
+    --[Ebene32] AS "Ebene32",
+    --[Ebene33] AS "Ebene33",
+    --[Ebene34] AS "Ebene34",
+    --[Ebene35] AS "Ebene35",
+    --[Ebene36] AS "Ebene36",
+    --[Ebene37] AS "Ebene37",
+    --[Ebene38] AS "Ebene38",
+    --[Ebene39] AS "Ebene39",
+    --[Ebene40] AS "Ebene40",
+    --[Ebene41] AS "Ebene41",
+    --[Ebene42] AS "Ebene42",
+    --[Ebene43] AS "Ebene43",
+    --[Ebene44] AS "Ebene44",
+    --[Ebene45] AS "Ebene45",
+    --[Ebene46] AS "Ebene46",
+    --[Ebene47] AS "Ebene47",
+    --[Ebene48] AS "Ebene48",
+    --[Ebene49] AS "Ebene49",
+    --[Ebene50] AS "Ebene50",
+    [Ebene51] AS "Ebene51",
+    [Ebene52] AS "Ebene52",
+    [Ebene53] AS "Ebene53",
+    [Ebene54] AS "Ebene54",
+    [Ebene55] AS "Ebene55",
+    [Ebene56] AS "Ebene56",
+    --[Ebene57] AS "Ebene57",
+    --[Ebene58] AS "Ebene58",
+    --[Ebene59] AS "Ebene59",
+    --[Ebene60] AS "Ebene60",
+    [Ebene61] AS "Ebene61",
+    [Ebene62] AS "Ebene62",
+    [Ebene63] AS "Ebene63",
+    [Ebene64] AS "Ebene64",
+    [Ebene65] AS "Ebene65",
+    [Ebene66] AS "Ebene66",
+    --[Ebene67] AS "Ebene67",
+    --[Ebene68] AS "Ebene68",
+    --[Ebene69] AS "Ebene69",
+    --[Ebene70] AS "Ebene70",
+    [Ebene71] AS "Ebene71",
+    [Ebene72] AS "Ebene72",
+    [Ebene73] AS "Ebene73",
+    [Ebene74] AS "Ebene74",
+    [Ebene75] AS "Ebene75",
+    [Ebene76] AS "Ebene76",
+    [Ebene77] AS "Ebene77",
+    --[Ebene78] AS "Ebene78",
+    --[Ebene79] AS "Ebene79",
+    --[Ebene80] AS "Ebene80" 
+FROM [staging].[Kontenrahmen_KST_90_fm]
+GO
+
+CREATE VIEW [load].[Kontenrahmen_STK]
+AS
+SELECT --[Konto_Nr] AS "Konto_Nr",
+    --[Konto_Bezeichnung] AS "Konto_Bezeichnung",
+    --[Konto_Art] AS "Konto_Art",
+    --[Kostenstelle] AS "Kostenstelle",
+    --[STK] AS "STK",
+    --[Konto_1] AS "Konto_1",
+    --[Konto_2] AS "Konto_2",
+    --[Konto_3] AS "Konto_3",
+    --[Konto_4] AS "Konto_4",
+    --[Konto_5] AS "Konto_5",
+    --[Ebene1] AS "Ebene1",
+    --[Ebene2] AS "Ebene2",
+    --[Ebene3] AS "Ebene3",
+    --[Ebene4] AS "Ebene4",
+    --[Ebene5] AS "Ebene5",
+    --[Ebene6] AS "Ebene6",
+    --[Ebene7] AS "Ebene7",
+    --[Ebene8] AS "Ebene8",
+    --[Ebene9] AS "Ebene9",
+    --[Ebene10] AS "Ebene10",
+    [Ebene11] AS "Ebene11",
+    --[Ebene12] AS "Ebene12",
+    --[Ebene13] AS "Ebene13",
+    --[Ebene14] AS "Ebene14",
+    --[Ebene15] AS "Ebene15",
+    --[Ebene16] AS "Ebene16",
+    --[Ebene17] AS "Ebene17",
+    --[Ebene18] AS "Ebene18",
+    --[Ebene19] AS "Ebene19",
+    --[Ebene20] AS "Ebene20",
+    [Ebene21] AS "Ebene21",
+    --[Ebene22] AS "Ebene22",
+    --[Ebene23] AS "Ebene23",
+    --[Ebene24] AS "Ebene24",
+    --[Ebene25] AS "Ebene25",
+    --[Ebene26] AS "Ebene26",
+    --[Ebene27] AS "Ebene27",
+    --[Ebene28] AS "Ebene28",
+    --[Ebene29] AS "Ebene29",
+    --[Ebene30] AS "Ebene30",
+    [Ebene31] AS "Ebene31",
+    --[Ebene32] AS "Ebene32",
+    --[Ebene33] AS "Ebene33",
+    --[Ebene34] AS "Ebene34",
+    --[Ebene35] AS "Ebene35",
+    --[Ebene36] AS "Ebene36",
+    --[Ebene37] AS "Ebene37",
+    --[Ebene38] AS "Ebene38",
+    --[Ebene39] AS "Ebene39",
+    --[Ebene40] AS "Ebene40",
+    --[Ebene41] AS "Ebene41",
+    --[Ebene42] AS "Ebene42",
+    --[Ebene43] AS "Ebene43",
+    --[Ebene44] AS "Ebene44",
+    --[Ebene45] AS "Ebene45",
+    --[Ebene46] AS "Ebene46",
+    --[Ebene47] AS "Ebene47",
+    --[Ebene48] AS "Ebene48",
+    --[Ebene49] AS "Ebene49",
+    --[Ebene50] AS "Ebene50",
+    [Ebene51] AS "Ebene51",
+    [Ebene52] AS "Ebene52",
+    [Ebene53] AS "Ebene53",
+    [Ebene54] AS "Ebene54",
+    [Ebene55] AS "Ebene55",
+    [Ebene56] AS "Ebene56",
+    --[Ebene57] AS "Ebene57",
+    --[Ebene58] AS "Ebene58",
+    --[Ebene59] AS "Ebene59",
+    --[Ebene60] AS "Ebene60",
+    [Ebene61] AS "Ebene61",
+    [Ebene62] AS "Ebene62",
+    [Ebene63] AS "Ebene63",
+    [Ebene64] AS "Ebene64",
+    [Ebene65] AS "Ebene65",
+    [Ebene66] AS "Ebene66",
+    --[Ebene67] AS "Ebene67",
+    --[Ebene68] AS "Ebene68",
+    --[Ebene69] AS "Ebene69",
+    --[Ebene70] AS "Ebene70" 
+FROM [staging].[Kontenrahmen_STK_fm]
+GO
+
+CREATE VIEW [load].[SKR_Absatzkanal]
+AS
+SELECT [Ebene21] AS "Ebene21",
+    [Absatzkanal_mit_Bez] AS "Absatzkanal_mit_Bez",
+    --[Ebene23] AS "Ebene23",
+    --[Ebene24] AS "Ebene24",
+    --[Ebene25] AS "Ebene25",
+    --[Ebene26] AS "Ebene26",
+    --[Ebene27] AS "Ebene27",
+    --[Ebene28] AS "Ebene28",
+    --[Ebene29] AS "Ebene29",
+    --[Ebene30] AS "Ebene30",
+    [Absatzkanal] AS "Absatzkanal" 
+FROM [staging].[SKR_Absatzkanal_fm]
+GO
+
+CREATE VIEW [load].[SKR_Herkunft_KST]
+AS
+SELECT [Ebene11] AS "Ebene11",
+    [KST_mit_Bez] AS "KST_mit_Bez",
+    --[Ebene13] AS "Ebene13",
+    --[Ebene14] AS "Ebene14",
+    --[Ebene15] AS "Ebene15",
+    --[Ebene16] AS "Ebene16",
+    --[Ebene17] AS "Ebene17",
+    --[Ebene18] AS "Ebene18",
+    --[Ebene19] AS "Ebene19",
+    --[Ebene20] AS "Ebene20",
+    [KST] AS "KST" 
+FROM [staging].[SKR_Herkunft_KST_fm]
+GO
+
+CREATE VIEW [load].[SKR_Kostenträger]
+AS
+SELECT [Ebene31] AS "Ebene31",
+    --[Ebene32] AS "Ebene32",
+    --[Ebene33] AS "Ebene33",
+    --[Ebene34] AS "Ebene34",
+    --[Ebene35] AS "Ebene35",
+    --[Ebene36] AS "Ebene36",
+    --[Ebene37] AS "Ebene37",
+    --[Ebene38] AS "Ebene38",
+    --[Ebene39] AS "Ebene39",
+    --[Ebene40] AS "Ebene40",
+    [Kostenträger_mit_Bez] AS "Kostenträger_mit_Bez",
+    --[Ebene_Marke] AS "Ebene_Marke",
+    [Kostenträger_FIBU] AS "Kostenträger_FIBU" 
+FROM [staging].[SKR_Kostenträger_fm]
+GO
+
+CREATE VIEW [load].[SKR_Marke]
+AS
+SELECT [Marke_mit_Bez] AS "Marke_mit_Bez",
+    --[Ebene42] AS "Ebene42",
+    --[Ebene43] AS "Ebene43",
+    --[Ebene44] AS "Ebene44",
+    --[Ebene45] AS "Ebene45",
+    --[Ebene46] AS "Ebene46",
+    --[Ebene47] AS "Ebene47",
+    --[Ebene48] AS "Ebene48",
+    --[Ebene49] AS "Ebene49",
+    --[Ebene50] AS "Ebene50",
+    [Marke] AS "Marke" 
+FROM [staging].[SKR_Marke_fm]
+GO
+
+CREATE VIEW [load].[Belege_EDS_SKR_ohne_KST_90]
+AS
+SELECT [Rechtseinheit_ID] AS "Rechtseinheit_ID",
+    [Rechtseinheit_Name] AS "Rechtseinheit_Name",
+    [Betrieb_ID] AS "Betrieb_ID",
+    [Betrieb_Name] AS "Betrieb_Name",
+    [Konto] AS "Konto",
+    [Acct Nr] AS "Acct Nr",
+    [Text] AS "Text",
+    --[Kostenstelle_ori] AS "Kostenstelle_ori",
+    --[KST_mit_Bez_ori] AS "KST_mit_Bez_ori",
+    [KST] AS "KST",
+    [Markencode] AS "Markencode",
+    [Fahrgestellnummer] AS "Fahrgestellnummer",
+    [Konto_Buchung] AS "Konto_Buchung",
+    --[Marke_mit_Bez_ori] AS "Marke_mit_Bez_ori",
+    [Marke] AS "Marke",
+    --[Ebene21_ori] AS "Ebene21_ori",
+    --[Absatzkanal_mit_Bez_ori] AS "Absatzkanal_mit_Bez_ori",
+    [Absatzkanal] AS "Absatzkanal",
+    --[Ebene31_ori] AS "Ebene31_ori",
+    --[Kostenträger_mit_Bez_ori] AS "Kostenträger_mit_Bez_ori",
+    [Kostenträger_FIBU] AS "Kostenträger_FIBU",
+    [Ebene71] AS "Ebene71",
+    [Ebene72] AS "Ebene72",
+    [Ebene73] AS "Ebene73",
+    [Ebene74] AS "Ebene74",
+    [Ebene75] AS "Ebene75",
+    [Ebene76] AS "Ebene76",
+    [Ebene77] AS "Ebene77",
+    --[Ebene81] AS "Ebene81",
+    --[Ebene82] AS "Ebene82",
+    --[Ebene83] AS "Ebene83",
+    --[Ebene84] AS "Ebene84",
+    --[Ebene85] AS "Ebene85",
+    --[Ebene86] AS "Ebene86",
+    [GuV_Bilanz] AS "GuV_Bilanz",
+    [Susa] AS "Susa",
+    [Mandant] AS "Mandant",
+    [Ist] AS "Ist",
+    [Menge] AS "Menge",
+    --[Fabrikat] AS "Fabrikat",
+    --[Fabrikat_Order_By] AS "Fabrikat_Order_By",
+    [Bookkeep Date] AS "Bookkeep Date",
+    [Ebene61] AS "Ebene61",
+    [Ebene62] AS "Ebene62",
+    [Ebene63] AS "Ebene63",
+    [Ebene64] AS "Ebene64",
+    [Ebene65] AS "Ebene65",
+    [Ebene66] AS "Ebene66",
+    Monat_Belege AS "Monat_Belege" 
+FROM [staging].[Belege_EDS_SKR_ohne_KST_90_fm]
+GO
+
+CREATE VIEW [load].[Belege_EDS_SKR_KST_90]
+AS
+SELECT [Rechtseinheit_ID] AS "Rechtseinheit_ID",
+    [Rechtseinheit_Name] AS "Rechtseinheit_Name",
+    [Betrieb_ID] AS "Betrieb_ID",
+    [Betrieb_Name] AS "Betrieb_Name",
+    [Konto] AS "Konto",
+    [Acct Nr] AS "Acct Nr",
+    [Text] AS "Text",
+    --[Kostenstelle_ori] AS "Kostenstelle_ori",
+    --[KST_mit_Bez_ori] AS "KST_mit_Bez_ori",
+    [KST] AS "KST",
+    [Markencode] AS "Markencode",
+    [Fahrgestellnummer] AS "Fahrgestellnummer",
+    [Konto_Buchung] AS "Konto_Buchung",
+    --[Marke_mit_Bez_ori] AS "Marke_mit_Bez_ori",
+    [Marke] AS "Marke",
+    --[Ebene21_ori] AS "Ebene21_ori",
+    --[Absatzkanal_mit_Bez_ori] AS "Absatzkanal_mit_Bez_ori",
+    [Absatzkanal] AS "Absatzkanal",
+    --[Ebene31_ori] AS "Ebene31_ori",
+    --[Kostenträger_mit_Bez_ori] AS "Kostenträger_mit_Bez_ori",
+    [Kostenträger_FIBU] AS "Kostenträger_FIBU",
+    [Ebene71] AS "Ebene71",
+    [Ebene72] AS "Ebene72",
+    [Ebene73] AS "Ebene73",
+    [Ebene74] AS "Ebene74",
+    [Ebene75] AS "Ebene75",
+    [Ebene76] AS "Ebene76",
+    [Ebene77] AS "Ebene77",
+    --[Ebene81] AS "Ebene81",
+    --[Ebene82] AS "Ebene82",
+    --[Ebene83] AS "Ebene83",
+    --[Ebene84] AS "Ebene84",
+    --[Ebene85] AS "Ebene85",
+    --[Ebene86] AS "Ebene86",
+    [GuV_Bilanz] AS "GuV_Bilanz",
+    [Susa] AS "Susa",
+    [Mandant] AS "Mandant",
+    [Ist] AS "Ist",
+    [Menge] AS "Menge",
+    --[Fabrikat] AS "Fabrikat",
+    --[Fabrikat_Order_By] AS "Fabrikat_Order_By",
+    [Bookkeep Date] AS "Bookkeep Date",
+    [Ebene61] AS "Ebene61",
+    [Ebene62] AS "Ebene62",
+    [Ebene63] AS "Ebene63",
+    [Ebene64] AS "Ebene64",
+    [Ebene65] AS "Ebene65",
+    [Ebene66] AS "Ebene66",
+    Monat_Belege AS "Monat_Belege" 
+FROM [staging].[Belege_EDS_SKR_KST_90_fm]
+GO
+
+CREATE VIEW [load].[Belege_EDS_SKR_Stk]
+AS
+SELECT [Rechtseinheit_ID] AS "Rechtseinheit_ID",
+    [Rechtseinheit_Name] AS "Rechtseinheit_Name",
+    [Betrieb_ID] AS "Betrieb_ID",
+    [Betrieb_Name] AS "Betrieb_Name",
+    [Konto] AS "Konto",
+    [Acct Nr] AS "Acct Nr",
+    [Text] AS "Text",
+    --[Kostenstelle_ori] AS "Kostenstelle_ori",
+    --[KST_mit_Bez_ori] AS "KST_mit_Bez_ori",
+    [KST] AS "KST",
+    [Markencode] AS "Markencode",
+    [Fahrgestellnummer] AS "Fahrgestellnummer",
+    [Konto_Buchung] AS "Konto_Buchung",
+    --[Marke_mit_Bez_ori] AS "Marke_mit_Bez_ori",
+    [Marke] AS "Marke",
+    --[Ebene21_ori] AS "Ebene21_ori",
+    --[Absatzkanal_mit_Bez_ori] AS "Absatzkanal_mit_Bez_ori",
+    [Absatzkanal] AS "Absatzkanal",
+    --[Ebene31_ori] AS "Ebene31_ori",
+    --[Kostenträger_mit_Bez_ori] AS "Kostenträger_mit_Bez_ori",
+    [Kostenträger_FIBU] AS "Kostenträger_FIBU",
+    [Ebene71] AS "Ebene71",
+    [Ebene72] AS "Ebene72",
+    [Ebene73] AS "Ebene73",
+    [Ebene74] AS "Ebene74",
+    [Ebene75] AS "Ebene75",
+    [Ebene76] AS "Ebene76",
+    [Ebene77] AS "Ebene77",
+    --[Ebene81] AS "Ebene81",
+    --[Ebene82] AS "Ebene82",
+    --[Ebene83] AS "Ebene83",
+    --[Ebene84] AS "Ebene84",
+    --[Ebene85] AS "Ebene85",
+    --[Ebene86] AS "Ebene86",
+    [GuV_Bilanz] AS "GuV_Bilanz",
+    [Susa] AS "Susa",
+    [Mandant] AS "Mandant",
+    [Ist] AS "Ist_Stk",
+    [Menge] AS "Menge",
+    --[Fabrikat] AS "Fabrikat",
+    --[Fabrikat_Order_By] AS "Fabrikat_Order_By",
+    [Bookkeep Date] AS "Bookkeep Date",
+    [Ebene61] AS "Ebene61",
+    [Ebene62] AS "Ebene62",
+    [Ebene63] AS "Ebene63",
+    [Ebene64] AS "Ebene64",
+    [Ebene65] AS "Ebene65",
+    [Ebene66] AS "Ebene66",
+    Monat_Belege AS "Monat_Belege" 
+FROM [staging].[Belege_EDS_SKR_Stk_fm]
+GO
+

Dosya farkı çok büyük olduğundan ihmal edildi
+ 108 - 195
data/S_Offene_Auftraege.json


+ 44 - 0
data/S_Offene_Auftraege_queries.txt

@@ -0,0 +1,44 @@
+CREATE VIEW [load].[current_date_Prognose_operativ]
+AS
+SELECT --[Bundeslaender Id] AS "Bundeslaender Id",
+    [Invoice Date] AS "Order Date",
+    --[Wochentage Id] AS "Wochentage Id",
+    --[Arbeitstag Mofr] AS "Arbeitstag Mofr",
+    --[Zaehler Mofr] AS "Zaehler Mofr",
+    --[Summe Mofr] AS "Summe Mofr",
+    --[Arbeitstag Mosa] AS "Arbeitstag Mosa",
+    --[Zaehler Mosa] AS "Zaehler Mosa",
+    --[Summe Mosa] AS "Summe Mosa",
+    --[Feiertage Id] AS "Feiertage Id",
+    --[Jahr] AS "Jahr",
+    --[Arbeitstag Nr Jahr] AS "Arbeitstag Nr Jahr",
+    --[Gesamt Arbeitstage] AS "Gesamt Arbeitstage" 
+FROM [staging].[current_date_Prognose_operativ_fm]
+GO
+
+CREATE VIEW [load].[Offene_Auftraege]
+AS
+SELECT [Hauptbetrieb_ID] AS "Hauptbetrieb_ID",
+    [Hauptbetrieb_Name] AS "Hauptbetrieb_Name",
+    [Standort_ID] AS "Standort_ID",
+    [Standort_Name] AS "Standort_Name",
+    [Serviceberater] AS "Serviceberater",
+    [Order Number] AS "Order Number",
+    [Fabrikat] AS "Fabrikat",
+    [Model] AS "Model",
+    [Fahrzeug] AS "Fahrzeug",
+    [Kostenstelle] AS "Kostenstelle",
+    --[Marke] AS "Marke",
+    [Kunde] AS "Kunde",
+    --[Turnover_Type_Desc] AS "Turnover_Type_Desc",
+    [Tage offen] AS "Tage offen",
+    [DG] AS "DG",
+    [Lohn] AS "Lohn",
+    [Teile] AS "Teile",
+    [Sonst.] AS "Sonst.",
+    [Auftragsart] AS "Auftragsart",
+    [Order Date] AS "Order Date",
+    [Tage seit letzt. Stemp.] AS "Tage seit letzt. Stemp." 
+FROM [staging].[Offene_Auftraege_fm]
+GO
+

+ 1 - 1
tox.ini

@@ -1,5 +1,5 @@
 [flake8]
-ignore = E712, W503, W504
+ignore = E203, E712, W503, W504
 max-line-length = 140
 # exclude = tests/*
 # max-complexity = 10

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor