Auto-update: Tue Jul 30 16:55:13 PDT 2024

This commit is contained in:
sanj 2024-07-30 16:55:13 -07:00
parent 3861fc0114
commit 482731c96e

View file

@ -721,11 +721,12 @@ class APIConfig(BaseModel):
stmt = await conn.prepare(insert_query) stmt = await conn.prepare(insert_query)
affected_rows = 0 affected_rows = 0
for change in tqdm(changes, desc=f"Syncing {table_name}", unit="row"): values_list = [[change[col] for col in columns] for change in changes]
values = [change[col] for col in columns]
debug(f"Executing query for {table_name} with values: {values}") # Use executemany for batch insert
result = await stmt.execute(*values) result = await stmt.executemany(values_list)
affected_rows += 1 # Since we're executing one at a time, each successful execution affects one row affected_rows = result.split()[-1] if result else 0
affected_rows = int(affected_rows) if affected_rows.isdigit() else 0
return affected_rows return affected_rows
@ -737,6 +738,7 @@ class APIConfig(BaseModel):
async def sync_spatial_ref_sys(self, source_conn, dest_conn): async def sync_spatial_ref_sys(self, source_conn, dest_conn):
try: try:
# Get all entries from the source # Get all entries from the source