aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/report_ops/wires.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/python/report_ops/wires.py b/python/report_ops/wires.py
index 1a806808..789be2f1 100644
--- a/python/report_ops/wires.py
+++ b/python/report_ops/wires.py
@@ -130,13 +130,25 @@ class NTWireReport(WireReport, custodian="NT"):
class UMBWireReport(WireReport, custodian="UMB"):
+ # UMB has no unique identifier. We just delete and add back
+ def __post_init__(self):
+ with self._conn.cursor() as c:
+ c.execute(
+ "DELETE FROM custodian_wires WHERE date=%s AND fund=%s AND custodian=%s",
+ (
+ self.date,
+ self.fund,
+ self.custodian,
+ ),
+ )
+ self._conn.commit()
+
def __iter__(self):
df = pd.read_excel(self.get_report(), skiprows=3)
df["index"] = df.index
df["Unique Ref"] = df.apply(
lambda x: f'{x["Transaction Date"]}-{x["index"]}', axis=1
)
- self.clear_sql_entries()
if not df.iloc[0]["Transaction Date"].startswith("No records"):
return (
(
@@ -162,19 +174,6 @@ class UMBWireReport(WireReport, custodian="UMB"):
f"File received no wires for {self.fund}: {self.custodian} {self.date}"
)
- def clear_sql_entries(self):
- conn = dbconn("dawndb")
- with conn.cursor() as c:
- c.execute(
- "DELETE FROM custodian_wires WHERE date=%s AND fund=%s AND custodian=%s",
- (
- self.date,
- self.fund,
- self.custodian,
- ),
- )
- conn.commit()
-
class SCOTIAWireReport(WireReport, custodian="SCOTIA"):
def __iter__(self):