From 711c0416984264048d14e6b5d970da7bc12c42ee Mon Sep 17 00:00:00 2001
From: sanj <67624670+iodrift@users.noreply.github.com>
Date: Thu, 25 Jul 2024 00:08:32 -0700
Subject: [PATCH] Auto-update: Thu Jul 25 00:08:32 PDT 2024

---
 sijapi/classes.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sijapi/classes.py b/sijapi/classes.py
index 147f2e6..76883cf 100644
--- a/sijapi/classes.py
+++ b/sijapi/classes.py
@@ -375,12 +375,13 @@ class APIConfig(BaseModel):
                     if rows:
                         columns = rows[0].keys()
                         # Upsert records to the destination table
-                        await dest_conn.executemany(f"""
-                            INSERT INTO {table_name} ({', '.join(columns)})
-                            VALUES ({', '.join(f'${i+1}' for i in range(len(columns)))})
-                            ON CONFLICT ({', '.join(pk_cols)}) DO UPDATE SET
-                            {', '.join(f"{col} = EXCLUDED.{col}" for col in columns if col not in pk_cols)}
-                        """, [tuple(row[col] for col in columns) for row in rows])
+                        for row in rows:
+                            await dest_conn.execute(f"""
+                                INSERT INTO {table_name} ({', '.join(columns)})
+                                VALUES ({', '.join(f'${i+1}' for i in range(len(columns)))})
+                                ON CONFLICT ({', '.join(pk_cols)}) DO UPDATE SET
+                                {', '.join(f"{col} = EXCLUDED.{col}" for col in columns if col not in pk_cols)}
+                            """, *[row[col] for col in columns])
                     
                     info(f"Completed processing table: {table_name}")