Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return db excuction result #1718

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sync/src/module/data_synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def process_seedlots(oracle_config, postgres_config, track_config, track_db_conn

if result is not None:
original_seed_qty = result.fetchone()
if original_seed_qty and original_seed_qty[0] == 0:
if original_seed_qty and not original_seed_qty[0]:
processes.append([{"interface_id":"SEEDLOT_OWNER_QUANTITY_EXTRACT","execution_id":"102","execution_order":"20","source_file":"/SQL/SPAR/POSTGRES_SEEDLOT_OWNER_QUANTITY_EXTRACT.sql","source_table":"spar.seedlot_owner_quantity","source_db_type":"POSTGRES","target_table":"the.seedlot_owner_quantity","target_primary_key":"seedlot_number,client_number,client_locn_code","target_db_type":"ORACLE","run_mode":"UPSERT","ignore_columns_on_update":"qty_reserved,qty_rsrvd_cmtd_pln,qty_rsrvd_cmtd_apr,qty_surplus,qty_srpls_cmtd_pln,qty_srpls_cmtd_apr"}])

#delete all tables in RI order (reversing order of processes dataframe)
Expand Down
5 changes: 3 additions & 2 deletions sync/src/module/database_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def __exit__(self, exc_type, exc_val, exc_tb):

def execute(self, query, params):
""" Runs a SQL statement. """
self.conn.execute(text(query), params)
result = self.conn.execute(text(query), params or {})
return result

def select(self, query, params=None):
""" Runs a SQL statement. """
result = self.conn.execute(text(query), params)
result = self.conn.execute(text(query), params or {})
return result

def health_check(self) -> bool:
Expand Down
Loading