ソースを参照

bcp_log jetzt in gctools

gc-server3 1 年間 前
コミット
447aa06038
6 ファイル変更156 行追加109 行削除
  1. 83 0
      database/SQL/bcp.csv.log
  2. 0 83
      database/SQL/temp/info.log
  3. 1 0
      database/__init__.py
  4. 65 26
      database/bcp_log.py
  5. 7 0
      db.py
  6. BIN
      dist/gctools.exe

+ 83 - 0
database/SQL/bcp.csv.log

@@ -0,0 +1,83 @@
+filename;timestamp;imported;exported;ignored;missing;import_duration;export_duration;file_size
+CAR_STATISTIC_1;18.01.2023 23:12:45;26179;26179;0.0;0.0;1.922;0.219;-1
+COMM_TRANS_UNIT_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.047;0.001;-1
+COMM_UNIT_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+COURTESY_CAR_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.031;0.001;-1
+CUSTOMER_1;18.01.2023 23:12:45;20937;20937;0.0;0.0;0.828;1.031;-1
+CUSTOMER_TRANSACT_1;18.01.2023 23:12:45;61306;61306;0.0;0.0;0.953;0.969;-1
+DEPARTMENT_TYPE_1;18.01.2023 23:12:45;11;11;0.0;0.0;0.001;0.001;-1
+EMPLOYEE_1;18.01.2023 23:12:45;84;84;0.0;0.0;0.001;0.001;-1
+GLOBAL_MAKE_1;18.01.2023 23:12:45;164;164;0.0;0.0;0.001;0.015;-1
+GM_DRIVE_ORDER_1;18.01.2023 23:12:45;619;619;0.0;0.0;0.031;0.047;-1
+ORDER_ACCUMULATION_1;18.01.2023 23:12:45;318824;318824;0.0;0.0;1.704;1.312;-1
+ORDER_HEADER_1;18.01.2023 23:12:45;21846;21846;0.0;0.0;1.016;1.156;-1
+ORDER_LINE_1;18.01.2023 23:12:45;210570;210570;0.0;0.0;14.016;1.813;-1
+ORDER_OPEN_ITEMS_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+ORDER_SERVICE_SCHEMES_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.031;0.001;-1
+PERSON_1;18.01.2023 23:12:45;110;110;0.0;0.0;0.001;0.001;-1
+PERSON_INFO_1;18.01.2023 23:12:45;61;61;0.0;0.0;0.001;0.001;-1
+PRODUCT_FILE_1;18.01.2023 23:12:45;11652;11652;0.0;0.0;0.328;0.375;-1
+PRODUCT_STOCK_FILE_1;18.01.2023 23:12:45;11651;11651;0.0;0.0;0.187;0.14;-1
+PROFILE_1;18.01.2023 23:12:45;93;93;0.0;0.0;0.001;0.001;-1
+PROFILE_TYPE_1;18.01.2023 23:12:45;209;209;0.0;0.0;0.001;0.001;-1
+PUNCH_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.016;0.001;-1
+PURCH_DISCOUNTS_1;18.01.2023 23:12:45;30928;30928;0.0;0.0;0.266;0.156;-1
+PURCH_DISC_TYPES_1;18.01.2023 23:12:45;62;62;0.0;0.0;0.001;0.001;-1
+SERVICE_2000_FILE_1;18.01.2023 23:12:45;5;5;0.0;0.0;0.094;0.016;-1
+SITE_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+SUPPLIER_1;18.01.2023 23:12:45;2223;2223;0.0;0.0;0.046;0.063;-1
+SUPPLIER_TRANSACT_1;18.01.2023 23:12:45;40115;40115;0.0;0.0;2.031;0.641;-1
+TIME_CONTROL_END_1;18.01.2023 23:12:45;224557;224557;0.0;0.0;9.953;1.86;-1
+TIME_CONTROL_OPEN_1;18.01.2023 23:12:45;13;13;0.0;0.0;0.001;0.001;-1
+TIME_CONTROL_TRANS_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.11;0.001;-1
+TRANSACTION_TYPE_1;18.01.2023 23:12:45;3;3;0.0;0.0;0.001;0.001;-1
+UNIT_CHANGE_HIST_1;18.01.2023 23:12:45;27817;27817;0.0;0.0;0.171;0.187;-1
+UNIT_FILE_1;18.01.2023 23:12:45;11587;11587;0.0;0.0;0.407;0.485;-1
+UNIT_LINK_EXT_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.047;0.001;-1
+UNIT_SALES_PRICE_LOG_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+UNIT_STATUS_HIST_1;18.01.2023 23:12:45;12603;12603;0.0;0.0;0.078;0.063;-1
+UNIT_TEMP_TAB_GRNI_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+UNIT_TRANSFER_TAB_1;18.01.2023 23:12:45;61365;61365;0.0;0.0;0.312;0.266;-1
+UNIT_TYPE_FILE_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.125;0.001;-1
+UPDATE_OPTION_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.016;0.001;-1
+VEHICLE_1;18.01.2023 23:12:45;29343;29343;0.0;0.0;1.688;2.094;-1
+VEHICLE_ACCRUALS_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+VEHICLE_DOCKETCARD_1;18.01.2023 23:12:45;6503;6503;0.0;0.0;0.344;0.172;-1
+VEHICLE_EXTENSION_1;18.01.2023 23:12:45;29324;29324;0.0;0.0;0.313;0.328;-1
+VEH_CARGRP_PURCHORIGIN_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+VEH_CLASSIFICATION_CODE_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+VEH_IN_TRANSIT_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.031;0.001;-1
+VEH_LINK_EXT_1;18.01.2023 23:12:45;44;44;0.0;0.0;0.001;0.001;-1
+VEH_MAX_STOCK_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+VEH_ORDER_HEADER_1;18.01.2023 23:12:45;21472;21472;0.0;0.0;0.688;0.688;-1
+VEH_ORDER_LINE_1;18.01.2023 23:12:45;22379;22379;0.0;0.0;0.39;0.266;-1
+VEH_ORDER_OPTION_1;18.01.2023 23:12:45;119100;119100;0.0;0.0;6.734;1.75;-1
+VEH_TRANSACT_COLUMNS_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.015;-1
+VEH_TRANSACT_GRID_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+VEH_TRANSACT_GROUPS_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+VEH_TRANSMISSION_CODES_1;18.01.2023 23:12:45;9;9;0.0;0.0;0.001;0.015;-1
+VPP25_1;18.01.2023 23:12:45;36;36;0.0;0.0;0.001;0.001;-1
+VPP2C_1;18.01.2023 23:12:45;33;33;0.0;0.0;0.125;0.001;-1
+VPP43_1;18.01.2023 23:12:45;87;87;0.0;0.0;0.062;0.001;-1
+VPP48_1;18.01.2023 23:12:45;24;24;0.0;0.0;0.001;0.001;-1
+VPP4K_1;18.01.2023 23:12:45;31;31;0.0;0.0;0.001;0.001;-1
+VPP51_1;18.01.2023 23:12:45;205;205;0.0;0.0;0.001;0.001;-1
+VPP53_1;18.01.2023 23:12:45;1213;1213;0.0;0.0;0.016;0.001;-1
+VPP5A_1;18.01.2023 23:12:45;45;45;0.0;0.0;0.001;0.016;-1
+VPP5M_1;18.01.2023 23:12:45;1067;1067;0.0;0.0;0.001;0.001;-1
+VPP5Q_1;18.01.2023 23:12:45;538;538;0.0;0.0;0.001;0.001;-1
+VPP5R_1;18.01.2023 23:12:45;8;8;0.0;0.0;0.001;0.001;-1
+VPP61_1;18.01.2023 23:12:45;1;1;0.0;0.0;0.001;0.016;-1
+VPP65_1;18.01.2023 23:12:45;14;14;0.0;0.0;0.001;0.001;-1
+VPP72_1;18.01.2023 23:12:45;42;42;0.0;0.0;0.016;0.001;-1
+VPP73_1;18.01.2023 23:12:45;24;24;0.0;0.0;0.001;0.016;-1
+VPP74_1;18.01.2023 23:12:45;595;595;0.0;0.0;0.015;0.001;-1
+VPP91_1;18.01.2023 23:12:45;4;4;0.0;0.0;0.001;0.001;-1
+VPP93_1;18.01.2023 23:12:45;36;36;0.0;0.0;0.001;0.015;-1
+VPPT1_1;18.01.2023 23:12:45;10773;10773;0.0;0.0;0.047;0.031;-1
+WORKING_PERIOD_1;18.01.2023 23:12:45;128;128;0.0;0.0;0.047;0.001;-1
+WORKSHOP_ORDER_SPLIT_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+WORKSHOP_PLANNING_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+WORKSHOP_TEAMS_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+WORK_LINE_STATUS_1;18.01.2023 23:12:45;0;0;0.0;0.0;0.001;0.001;-1
+WORK_UNITS_1;18.01.2023 23:12:45;6;6;0.0;0.0;0.001;0.001;-1

+ 0 - 83
database/SQL/temp/info.log

@@ -1,83 +0,0 @@
-filename;timestamp;imported;exported;ignored;import_duration;export_duration
-CAR_STATISTIC_1;22.09.2021 15:05:53;26179;26179;0;0;1.922;0.219
-COMM_TRANS_UNIT_1;22.09.2021 15:05:53;0;0;0;0;0.047;0.001
-COMM_UNIT_1;22.09.2021 15:05:54;0;0;0;0;0.001;0.001
-COURTESY_CAR_1;22.09.2021 15:05:54;0;0;0;0;0.031;0.001
-CUSTOMER_1;22.09.2021 15:05:55;20937;20937;0;0;0.828;1.031
-CUSTOMER_TRANSACT_1;22.09.2021 15:05:57;61306;61306;0;0;0.953;0.969
-DEPARTMENT_TYPE_1;22.09.2021 15:05:58;11;11;0;0;0.001;0.001
-EMPLOYEE_1;22.09.2021 15:05:58;84;84;0;0;0.001;0.001
-GLOBAL_MAKE_1;22.09.2021 15:05:58;164;164;0;0;0.001;0.015
-GM_DRIVE_ORDER_1;22.09.2021 15:05:58;619;619;0;0;0.031;0.047
-ORDER_ACCUMULATION_1;22.09.2021 15:06:00;318824;318824;0;0;1.704;1.312
-ORDER_HEADER_1;22.09.2021 15:06:02;21846;21846;0;0;1.016;1.156
-ORDER_LINE_1;22.09.2021 15:06:18;210570;210570;0;0;14.016;1.813
-ORDER_OPEN_ITEMS_1;22.09.2021 15:06:20;0;0;0;0;0.001;0.001
-ORDER_SERVICE_SCHEMES_1;22.09.2021 15:06:20;0;0;0;0;0.031;0.001
-PERSON_1;22.09.2021 15:06:20;110;110;0;0;0.001;0.001
-PERSON_INFO_1;22.09.2021 15:06:20;61;61;0;0;0.001;0.001
-PRODUCT_FILE_1;22.09.2021 15:06:21;11652;11652;0;0;0.328;0.375
-PRODUCT_STOCK_FILE_1;22.09.2021 15:06:21;11651;11651;0;0;0.187;0.14
-PROFILE_1;22.09.2021 15:06:21;93;93;0;0;0.001;0.001
-PROFILE_TYPE_1;22.09.2021 15:06:22;209;209;0;0;0.001;0.001
-PUNCH_1;22.09.2021 15:06:22;0;0;0;0;0.016;0.001
-PURCH_DISCOUNTS_1;22.09.2021 15:06:22;30928;30928;0;0;0.266;0.156
-PURCH_DISC_TYPES_1;22.09.2021 15:06:22;62;62;0;0;0.001;0.001
-SERVICE_2000_FILE_1;22.09.2021 15:06:23;5;5;0;0;0.094;0.016
-SITE_1;22.09.2021 15:06:23;0;0;0;0;0.001;0.001
-SUPPLIER_1;22.09.2021 15:06:23;2223;2223;0;0;0.046;0.063
-SUPPLIER_TRANSACT_1;22.09.2021 15:06:25;40115;40115;0;0;2.031;0.641
-TIME_CONTROL_END_1;22.09.2021 15:06:36;224557;224557;0;0;9.953;1.86
-TIME_CONTROL_OPEN_1;22.09.2021 15:06:38;13;13;0;0;0.001;0.001
-TIME_CONTROL_TRANS_1;22.09.2021 15:06:38;0;0;0;0;0.11;0.001
-TRANSACTION_TYPE_1;22.09.2021 15:06:38;3;3;0;0;0.001;0.001
-UNIT_CHANGE_HIST_1;22.09.2021 15:06:38;27817;27817;0;0;0.171;0.187
-UNIT_FILE_1;22.09.2021 15:06:39;11587;11587;0;0;0.407;0.485
-UNIT_LINK_EXT_1;22.09.2021 15:06:40;0;0;0;0;0.047;0.001
-UNIT_SALES_PRICE_LOG_1;22.09.2021 15:06:40;0;0;0;0;0.001;0.001
-UNIT_STATUS_HIST_1;22.09.2021 15:06:40;12603;12603;0;0;0.078;0.063
-UNIT_TEMP_TAB_GRNI_1;22.09.2021 15:06:40;0;0;0;0;0.001;0.001
-UNIT_TRANSFER_TAB_1;22.09.2021 15:06:41;61365;61365;0;0;0.312;0.266
-UNIT_TYPE_FILE_1;22.09.2021 15:06:41;0;0;0;0;0.125;0.001
-UPDATE_OPTION_1;22.09.2021 15:06:41;0;0;0;0;0.016;0.001
-VEHICLE_1;22.09.2021 15:06:43;29343;29343;0;0;1.688;2.094
-VEHICLE_ACCRUALS_1;22.09.2021 15:06:45;0;0;0;0;0.001;0.001
-VEHICLE_DOCKETCARD_1;22.09.2021 15:06:46;6503;6503;0;0;0.344;0.172
-VEHICLE_EXTENSION_1;22.09.2021 15:06:46;29324;29324;0;0;0.313;0.328
-VEH_CARGRP_PURCHORIGIN_1;22.09.2021 15:06:47;0;0;0;0;0.001;0.001
-VEH_CLASSIFICATION_CODE_1;22.09.2021 15:06:47;0;0;0;0;0.001;0.001
-VEH_IN_TRANSIT_1;22.09.2021 15:06:47;0;0;0;0;0.031;0.001
-VEH_LINK_EXT_1;22.09.2021 15:06:47;44;44;0;0;0.001;0.001
-VEH_MAX_STOCK_1;22.09.2021 15:06:47;0;0;0;0;0.001;0.001
-VEH_ORDER_HEADER_1;22.09.2021 15:06:48;21472;21472;0;0;0.688;0.688
-VEH_ORDER_LINE_1;22.09.2021 15:06:49;22379;22379;0;0;0.39;0.266
-VEH_ORDER_OPTION_1;22.09.2021 15:06:56;119100;119100;0;0;6.734;1.75
-VEH_TRANSACT_COLUMNS_1;22.09.2021 15:06:58;0;0;0;0;0.001;0.015
-VEH_TRANSACT_GRID_1;22.09.2021 15:06:58;0;0;0;0;0.001;0.001
-VEH_TRANSACT_GROUPS_1;22.09.2021 15:06:58;0;0;0;0;0.001;0.001
-VEH_TRANSMISSION_CODES_1;22.09.2021 15:06:58;9;9;0;0;0.001;0.015
-VPP25_1;22.09.2021 15:06:59;36;36;0;0;0.001;0.001
-VPP2C_1;22.09.2021 15:06:59;33;33;0;0;0.125;0.001
-VPP43_1;22.09.2021 15:06:59;87;87;0;0;0.062;0.001
-VPP48_1;22.09.2021 15:06:59;24;24;0;0;0.001;0.001
-VPP4K_1;22.09.2021 15:06:59;31;31;0;0;0.001;0.001
-VPP51_1;22.09.2021 15:06:59;205;205;0;0;0.001;0.001
-VPP53_1;22.09.2021 15:06:59;1213;1213;0;0;0.016;0.001
-VPP5A_1;22.09.2021 15:07:00;45;45;0;0;0.001;0.016
-VPP5M_1;22.09.2021 15:07:00;1067;1067;0;0;0.001;0.001
-VPP5Q_1;22.09.2021 15:07:00;538;538;0;0;0.001;0.001
-VPP5R_1;22.09.2021 15:07:00;8;8;0;0;0.001;0.001
-VPP61_1;22.09.2021 15:07:00;1;1;0;0;0.001;0.016
-VPP65_1;22.09.2021 15:07:00;14;14;0;0;0.001;0.001
-VPP72_1;22.09.2021 15:07:00;42;42;0;0;0.016;0.001
-VPP73_1;22.09.2021 15:07:00;24;24;0;0;0.001;0.016
-VPP74_1;22.09.2021 15:07:01;595;595;0;0;0.015;0.001
-VPP91_1;22.09.2021 15:07:01;4;4;0;0;0.001;0.001
-VPP93_1;22.09.2021 15:07:01;36;36;0;0;0.001;0.015
-VPPT1_1;22.09.2021 15:07:01;10773;10773;0;0;0.047;0.031
-WORKING_PERIOD_1;22.09.2021 15:07:01;128;128;0;0;0.047;0.001
-WORKSHOP_ORDER_SPLIT_1;22.09.2021 15:07:01;0;0;0;0;0.001;0.001
-WORKSHOP_PLANNING_1;22.09.2021 15:07:01;0;0;0;0;0.001;0.001
-WORKSHOP_TEAMS_1;22.09.2021 15:07:01;0;0;0;0;0.001;0.001
-WORK_LINE_STATUS_1;22.09.2021 15:07:02;0;0;0;0;0.001;0.001
-WORK_UNITS_1;22.09.2021 15:07:02;6;6;0;0;0.001;0.001

+ 1 - 0
database/__init__.py

@@ -1,3 +1,4 @@
+from database.bcp_log import bcp_log
 from database.db_create import create
 from database.db_run import run
 from database.db_schema import schema

+ 65 - 26
database/bcp_log.py

@@ -6,13 +6,14 @@ from datetime import datetime
 
 @dataclass
 class BulkcopyResult:
-    filename: str
+    file_name: str
     timestamp: datetime
-    imported: int = 0
-    exported: int = 0
+    imported: int = -1
+    exported: int = -1
     ignored: int = 0
     import_duration: float = 0.0
     export_duration: float = 0.0
+    file_size: int = -1
 
     @property
     def missing(self) -> int:
@@ -20,15 +21,16 @@ class BulkcopyResult:
 
     def to_csv(self):
         return (
-            f"{self.filename};{self.timestamp.strftime('%d.%m.%Y %H:%M:%S')};"
+            f"{self.file_name};{self.timestamp.strftime('%d.%m.%Y %H:%M:%S')};"
             + f"{self.exported};{self.imported};{self.ignored};{self.missing};"
-            + f"{self.export_duration};{self.import_duration}"
+            + f"{self.export_duration};{self.import_duration};"
+            + f"{self.file_size}"
         )
 
     def __str__(self) -> str:
         return "\n".join(
             [
-                f"Filename: {self.filename}",
+                f"Filename: {self.file_name}",
                 f"Last run: {self.timestamp.strftime('%d.%m.%Y %H:%M')}",
                 "",
                 f"Exported: {self.exported:>7}",
@@ -38,47 +40,84 @@ class BulkcopyResult:
                 "",
                 f"Duration: {self.export_duration:>11} s",
                 f"          {self.import_duration:>11} s",
+                "",
+                f"Filesize: {self.file_size:>7}",
             ]
         )
 
 
-def check_logfiles(prefix, base_dir):
-    ts = datetime.fromtimestamp(Path(f"{base_dir}/{prefix}.in.log").stat().st_mtime)
-    result = BulkcopyResult(filename=prefix, timestamp=ts)
+def check_logfiles(prefix: str, base_dir: str) -> BulkcopyResult:
+    ts = datetime.fromtimestamp(Path(f"{base_dir}/{prefix}.bcp2.log").stat().st_mtime)
+    result = BulkcopyResult(file_name=prefix, timestamp=ts)
 
     with open(f"{base_dir}/{prefix}.in.log", "r") as frh:
-        result.ignored = len(frh.readlines())
+        result.ignored = len(frh.readlines()) / 2
 
     # info output of export
     with open(f"{base_dir}/{prefix}.bcp1.log", "r", encoding="cp850", errors="ignore") as frh:
         raw_logs = frh.read()
-        match = re.search(r"(\d+) Zeilen kopiert.", raw_logs)
-        result.exported = int(match.group(1)) if match else 0
-        match2 = re.search(r"Zeit .* gesamt: (\d+)", raw_logs)
-        result.export_duration = int(match2.group(1)) / 1000 if match2 else 0
+        result.exported = rows_copied(raw_logs)
+        result.export_duration = total_time(raw_logs)
 
     # info output of import
     with open(f"{base_dir}/{prefix}.bcp2.log", "r", encoding="cp850", errors="ignore") as frh:
         raw_logs = frh.read()
-        match = re.search(r"(\d+) Zeilen kopiert.", raw_logs)
-        result.imported = int(match.group(1)) if match else 0
-        match2 = re.search(r"Zeit .* gesamt: (\d+)", raw_logs)
-        result.import_duration = int(match2.group(1)) / 1000 if match2 else 0
+        result.imported = rows_copied(raw_logs)
+        result.import_duration = total_time(raw_logs)
 
+    csv_file = Path(f"{base_dir}/{prefix}.csv")
+    if csv_file.exists():
+        result.file_size = csv_file.stat().st_size
     return result
 
 
-def check_directory(base_dir):
-    res = []
-    for filename in Path(base_dir).glob("*.bcp1.log"):
+def rows_copied(raw_logs):
+    match = re.search(r"(\d+) Zeilen kopiert.", raw_logs)
+    if match:
+        return int(match.group(1))
+    match = re.search(r"(\d+) rows copied.", raw_logs)
+    if match:
+        return int(match.group(1))
+    return -1
+
+
+def total_time(raw_logs):
+    match = re.search(r"Zeit .* gesamt\s*: (\d+)", raw_logs)
+    if match:
+        return int(match.group(1)) / 1000
+    match = re.search(r"Clock Time .* Total\s*: (\d+)", raw_logs)
+    if match:
+        return int(match.group(1)) / 1000
+    return 0
+
+
+def check_directory(base_dir, res=None):
+    if res is None:
+        res = []
+    for folder in Path(base_dir).glob("*"):
+        if not folder.is_dir():
+            continue
+        res = check_directory(str(folder), res)
+
+    for filename in Path(base_dir).glob("*.bcp2.log"):
         stem = filename.name[:-9]
-        res.append(check_logfiles(stem, base_dir).to_csv())
-    with open(base_dir + "/info.log", "w") as fwh:
-        fwh.write("filename;timestamp;imported;exported;ignored;import_duration;export_duration\n")
-        fwh.write("\n".join(res))
+        res.append(check_logfiles(stem, base_dir))
+    return res
+
+
+def export_log_csv(res, output_file):
+    with open(output_file, "w") as fwh:
+        fwh.write("filename;timestamp;imported;exported;ignored;missing;import_duration;export_duration;file_size\n")
+        for log in res:
+            fwh.write(log.to_csv() + "\n")
+
+
+def bcp_log(logs_dir, output_file):
+    res = check_directory(logs_dir)
+    export_log_csv(res, output_file)
 
 
 if __name__ == "__main__":
     base_dir = str(Path(__file__).parent)
-    check_directory(base_dir + "/SQL/temp")
+    bcp_log(base_dir + "/SQL/temp", base_dir + "/SQL/bcp.csv.log")
     # check_logfiles('ORDER_LINE_1')

+ 7 - 0
db.py

@@ -24,5 +24,12 @@ def schema():
     database.schema()
 
 
+@app.command()
+def bcp_log():
+    logs_dir = cfg.system_dir + "\\SQL\\temp"
+    output_file = cfg.logs_dir + "\\bcp.csv.log"
+    database.bcp_log(logs_dir, output_file)
+
+
 if __name__ == "__main__":
     app()

BIN
dist/gctools.exe