Skip to content
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
17 changes: 17 additions & 0 deletions scripts/utils/updateIbanFkPa/oracleUpdatesIbanFkPa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import oracledb

connection = oracledb.connect(
dsn=os.environ['SPRING_DATASOURCE_HOST'],
port=os.environ['SPRING_DATASOURCE_PORT'],
user=os.environ['SPRING_DATASOURCE_USERNAME'],
password=os.environ['SPRING_DATASOURCE_PASSWORD']
)
cursor = connection.cursor()

cursor.execute("UPDATE iban SET fk_pa = t.ext_pa FROM (SELECT master.fk_pa as ext_pa, master.fk_iban, MIN(master.inserted_date) FROM iban ib JOIN iban_master master ON master.fk_iban = ib.obj_id GROUP BY master.fk_pa, master.fk_iban) t WHERE obj_id = t.fk_iban AND fk_pa IS NULL")
connection.commit()

cursor.close()
connection.close()

17 changes: 17 additions & 0 deletions scripts/utils/updateIbanFkPa/postgresUpdateIbanFkPa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import psycopg2

sql_statement = 'UPDATE iban SET fk_pa = t.ext_pa FROM (SELECT master.fk_pa as ext_pa, master.fk_iban, MIN(master.inserted_date) FROM iban ib JOIN iban_master master ON master.fk_iban = ib.obj_id GROUP BY master.fk_pa, master.fk_iban) t WHERE obj_id = t.fk_iban AND fk_pa IS NULL'
connection = oracledb.connect(
database=os.environ['SPRING_DATASOURCE_DB']
host=os.environ['SPRING_DATASOURCE_HOST'],
port=os.environ['SPRING_DATASOURCE_PORT'],
user=os.environ['SPRING_DATASOURCE_USERNAME'],
password=os.environ['SPRING_DATASOURCE_PASSWORD']
)
cursor = connection.cursor()
cursor.execute(sql_statement)
connection.commit()

cursor.close()
connection.close()
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import oracledb

connection = oracledb.connect(
dsn=os.environ['SPRING_DATASOURCE_HOST'],
port=os.environ['SPRING_DATASOURCE_PORT'],
user=os.environ['SPRING_DATASOURCE_USERNAME'],
password=os.environ['SPRING_DATASOURCE_PASSWORD']
)
cursor = connection.cursor()

cursor.execute("UPDATE iban_master SET due_date = t.due_date FROM (SELECT DISTINCT ib.obj_id, ib.due_date FROM iban ib JOIN iban_master master ON master.fk_iban = ib.obj_id WHERE master.due_date IS NULL) t WHERE fk_iban = t.obj_id")
connection.commit()

cursor.close()
connection.close()

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import psycopg2

sql_statement = '"UPDATE iban_master SET due_date = t.due_date FROM (SELECT DISTINCT ib.obj_id, ib.due_date FROM iban ib JOIN iban_master master ON master.fk_iban = ib.obj_id WHERE master.due_date IS NULL) t WHERE fk_iban = t.obj_id"'
connection = oracledb.connect(
database=os.environ['SPRING_DATASOURCE_DB']
host=os.environ['SPRING_DATASOURCE_HOST'],
port=os.environ['SPRING_DATASOURCE_PORT'],
user=os.environ['SPRING_DATASOURCE_USERNAME'],
password=os.environ['SPRING_DATASOURCE_PASSWORD']
)
cursor = connection.cursor()
cursor.execute(sql_statement)
connection.commit()

cursor.close()
connection.close()
Loading