|
@@ -3,8 +3,7 @@ import json
|
|
|
from pathlib import Path
|
|
|
|
|
|
import pandas as pd
|
|
|
-import pyodbc
|
|
|
-from sqlalchemy import create_engine
|
|
|
+from pyodbc import ProgrammingError
|
|
|
|
|
|
from database.db_create import get_import_config
|
|
|
from database.model import DatabaseInspect, DbCreateConfig, create_db_ini, load_config
|
|
@@ -79,7 +78,7 @@ def compare(config_file: str = "database/CARLO.json"):
|
|
|
try:
|
|
|
q = source_db.cursor.execute(query_ts)
|
|
|
source_row_count_ts[client_db] = q.fetchone()[0]
|
|
|
- except pyodbc.ProgrammingError:
|
|
|
+ except ProgrammingError:
|
|
|
pass
|
|
|
|
|
|
if dest_row_count.get(client_db, 0) != source_row_count.get(client_db, 0):
|
|
@@ -115,12 +114,12 @@ def compare_details(
|
|
|
)
|
|
|
|
|
|
source_file = f"{cfg.stage_dir}\\source\\{table_client}.csv"
|
|
|
- source_data = pd.read_sql(query_source, create_engine(source_db.conn_string_sqlalchemy))
|
|
|
+ source_data = pd.read_sql(query_source, source_db.sqlalchemy_engine)
|
|
|
source_data["timestamp"] = source_data["timestamp"].apply(decode_ts)
|
|
|
source_data.to_csv(source_file, index=False)
|
|
|
|
|
|
dest_file = f"{cfg.stage_dir}\\dest\\{table_client}.csv"
|
|
|
- dest_data = pd.read_sql(query_dest, create_engine(dest_db.conn_string_sqlalchemy))
|
|
|
+ dest_data = pd.read_sql(query_dest, dest_db.sqlalchemy_engine)
|
|
|
dest_data["timestamp"] = dest_data["timestamp"].apply(decode_ts)
|
|
|
dest_data.to_csv(dest_file, index=False)
|
|
|
|