Skip to content

Commit

Permalink
fix: print accurate count of inserted rows
Browse files Browse the repository at this point in the history
  • Loading branch information
ahal committed Jun 10, 2024
1 parent fd8dc77 commit 947c884
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/fxci_etl/loaders/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ def insert(self, records: list[Record] | Record):
tables[record.table_name()].append(record)

for name, rows in tables.items():
print(rows[0])
table = self.get_table(name)
errors = self.client.insert_rows(table, [asdict(row) for row in rows])

if errors:
pprint(errors, indent=2)

num_inserted = len(records) - len(errors)
num_inserted = len(rows) - len(errors)
print(f"Inserted {num_inserted} records in table '{table}'")

0 comments on commit 947c884

Please sign in to comment.