From c31271349f17a435fcae01e05dfec9bf732282da Mon Sep 17 00:00:00 2001 From: David Roher Date: Thu, 12 Oct 2023 21:10:22 -0400 Subject: [PATCH] Fix cursor isolation on Python model --- dbt/adapters/duckdb/environments/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt/adapters/duckdb/environments/__init__.py b/dbt/adapters/duckdb/environments/__init__.py index f281ceec..8eaabf9c 100644 --- a/dbt/adapters/duckdb/environments/__init__.py +++ b/dbt/adapters/duckdb/environments/__init__.py @@ -154,8 +154,8 @@ def run_python_job( cur = cls.initialize_cursor(creds, con.cursor()) # Do the actual work to run the code here dbt = module.dbtObj(load_df_function) - df = module.model(dbt, cur) - module.materialize(df, con) + df = module.model(dbt, con) + module.materialize(df, cur) except Exception as err: raise DbtRuntimeError(f"Python model failed:\n" f"{err}") finally: