Use one DuckDB write connection for the entire update loop instead of opening/closing per row, wrapped in try/finally for proper cleanup. Move 'import duckdb' to module level with other imports.
Use one DuckDB write connection for the entire update loop instead of opening/closing per row, wrapped in try/finally for proper cleanup. Move 'import duckdb' to module level with other imports.