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

Commit

Permalink
custom sql change
Browse files Browse the repository at this point in the history
  • Loading branch information
vishreddy01 committed Jan 25, 2024
1 parent 5aa0127 commit b6bdc1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions data_replication_parametrized_audit_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,21 @@ def extract_from_oracle(table_name,source_schema,customsql_ind,customsql_query):
oracle_connection = OrcPool.acquire()
oracle_cursor = oracle_connection.cursor()
try:
if customsql_ind == "N":
if customsql_ind == "Y":
# Use placeholders in the query and bind the table name as a parameter
sql_query = f'SELECT * FROM {source_schema}.{table_name}'
sql_query=customsql_query
print(sql_query)
oracle_cursor.execute(sql_query)
rows = oracle_cursor.fetchall()
OrcPool.release(oracle_connection)
return rows
return rows
else:
sql_query=customsql_query
sql_query = f'SELECT * FROM {source_schema}.{table_name}'
print(sql_query)
oracle_cursor.execute(sql_query)
rows = oracle_cursor.fetchall()
OrcPool.release(oracle_connection)
return rows
return rows
except Exception as e:
audit_batch_status_insert(table_name,'failed')
print(f"Error extracting data from Oracle: {str(e)}")
Expand Down

0 comments on commit b6bdc1e

Please sign in to comment.