Auto-update: Tue Jul 30 16:48:36 PDT 2024

This commit is contained in:
sanj 2024-07-30 16:48:36 -07:00
parent b2a71a3dc5
commit c4ebb75953

View file

@ -501,8 +501,6 @@ class APIConfig(BaseModel):
err(f"Traceback: {traceback.format_exc()}")
return False
async def ensure_sync_trigger(self, conn, table_name):
await conn.execute(f"""
CREATE OR REPLACE FUNCTION update_version_and_server_id()
@ -521,7 +519,6 @@ class APIConfig(BaseModel):
FOR EACH ROW EXECUTE FUNCTION update_version_and_server_id();
""")
async def get_most_recent_source(self):
most_recent_source = None
max_version = -1
@ -688,7 +685,7 @@ class APIConfig(BaseModel):
try:
columns = list(changes[0].keys())
placeholders = [f'${i+1}' for i in range(len(columns))]
placeholders = [f'${i}' for i in range(1, len(columns) + 1)]
if has_primary_key:
insert_query = f"""
@ -719,7 +716,7 @@ class APIConfig(BaseModel):
for change in tqdm(changes, desc=f"Syncing {table_name}", unit="row"):
values = [change[col] for col in columns]
debug(f"Executing query for {table_name} with values: {values}")
result = await conn.execute(insert_query, *values) # Pass values as separate arguments
result = await conn.execute(insert_query, *values)
affected_rows += int(result.split()[-1])
return affected_rows
@ -731,7 +728,6 @@ class APIConfig(BaseModel):
async def sync_spatial_ref_sys(self, source_conn, dest_conn):
try:
# Get all entries from the source