Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
update data_replication_parametrized_audit_os.py
Browse files Browse the repository at this point in the history
Signed-off-by: abimichel <[email protected]>
  • Loading branch information
abimichel authored Feb 14, 2024
1 parent 5a0d4df commit 63f0c83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion data_replication_parametrized_audit_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def extract_from_oracle(table_name,source_schema,customsql_ind,customsql_query):
oracle_connection = OrcPool.acquire()
oracle_cursor = oracle_connection.cursor()
try:
current_time = datetime.datetime.now()
print("Replication Start:", current_time)
if customsql_ind == "Y":
# Use placeholders in the query and bind the table name as a parameter
sql_query=customsql_query
Expand Down Expand Up @@ -148,6 +150,9 @@ def load_into_postgres(table_name, data,target_schema):
insert_query = f'INSERT INTO {target_schema}.{table_name} VALUES ({", ".join(["%s"] * len(data[0]))})'
#insert_query = f'INSERT INTO {target_schema}.{table_name} VALUES %s'

current_time = datetime.datetime.now()
print("Replication End:", current_time)

# Use execute_batch for efficient batch insert
with postgres_connection.cursor() as cursor:
# Prepare the data as a list of tuples
Expand Down Expand Up @@ -185,7 +190,7 @@ def load_data_from_src_tgt(table_name,source_schema,target_schema,customsql_ind,
# Main ETL process
active_tables_rows =get_active_tables(mstr_schema,app_name)
print(active_tables_rows)
tables_to_extract = [(row[2],row[1],row[3],row[9],row[10]) for row in active_tables_rows]
tables_to_extract = [(row[2],row[1],row[3],row[8],row[9]) for row in active_tables_rows]

print(f"tables to extract are {tables_to_extract}")
print(f'No of concurrent tasks:{concurrent_tasks}')
Expand Down

0 comments on commit 63f0c83

Please sign in to comment.