From: Karl O. Pinc Date: Sun, 23 Jun 2024 02:03:57 +0000 (-0500) Subject: Throw invalid column count errors where the insert statement is executed X-Git-Url: https://papio.biology.duke.edu/gitweb/?a=commitdiff_plain;h=d77c2a7a802c6a948d2e10e8eba25eb2ced7ad9e;p=pgwui_bulk_upload Throw invalid column count errors where the insert statement is executed Psycopg 3 throws a generic ProgramimgError, so core.py has trouble reporting the problem. Perhaps this can be solved by creating a generic PreparedStmt class at the core level, but this works for the moment. --- diff --git a/src/pgwui_bulk_upload/views/bulk_upload.py b/src/pgwui_bulk_upload/views/bulk_upload.py index 633fc18..9dd250a 100644 --- a/src/pgwui_bulk_upload/views/bulk_upload.py +++ b/src/pgwui_bulk_upload/views/bulk_upload.py @@ -47,6 +47,7 @@ from pgwui_core.core import ( from pgwui_upload_core.views.upload import ( BaseTableUploadHandler, UploadCoreInitialPost, + match_insert_to_dataline, set_upload_response, ) @@ -114,7 +115,9 @@ class SaveBulkLine(DataLineProcessor, ParameterExecutor): filepath = data.filepath try: udl = thunk() - self.param_execute(self.insert_map[filepath], udl) + insert_stmt = self.insert_map[filepath] + match_insert_to_dataline(udl, insert_stmt, source_file=filepath) + self.param_execute(insert_stmt.stmt, udl) except (core_ex.DataLineError, core_ex.DBError) as exp: relation = data.relation raise exp.color(map_description(filepath, relation),