This pull request updates the Postgres plugin for the dbt-duckdb adapter to align with the latest DuckDB PostgreSQL extension (ATTACH syntax) and introduces improvements to functionality, testing, and error handling.
Changes Made:
Migration to ATTACH Syntax:
Replaced the deprecated CALL postgres_attach syntax with the new ATTACH command, returning the write-to-pg functionality.
Removed deprecated features like overwrite in favor of READ_ONLY.
Enhanced Configuration:
Added support for configuring additional attach options and extension settings, ensuring compatibility with the latest DuckDB Postgres extension features.
Improved Logging and Debugging:
Utilized AdapterLogger to provide clearer and more detailed error messages.
Enhanced traceability of plugin configuration and database attachment processes.
Updated Unit Tests:
Refactored and extended test coverage to validate new functionality and edge cases:
Successful ATTACH with default and custom configurations.
Read/write operations in both read-only and read-write modes.
Handling of PostgreSQL arrays and error conditions for invalid configurations.
Code Refactoring:
Improved code readability and maintainability by introducing helper methods (_set_extension_settings, _build_attach_statement).
Added type annotations for better developer experience and debugging.
Testing:
Verified all test cases pass successfully:
✅ 8 tests executed covering all key scenarios.
🔧 Addressed issues with outdated PostgreSQL array handling and error messages.
All changes validated against DuckDB version 1.1.3.
Impact:
Ensures compatibility with DuckDB’s latest PostgreSQL extension.
Improves user experience with better logging, clearer error messages, and broader configurability.
Streamlines the plugin's codebase for easier maintenance and future updates.
Checklist:
[x] Updated postgres.py to support ATTACH syntax.
[x] Updated test_postgres.py to reflect new features and configurations.
Related Issues:
Unfortunately, due to this issue the testing has to be done outside the VSCode dev container.
478
Please review the changes and let me know if additional updates or refinements are needed. Thank you for your time and consideration!🚀
Description:
This pull request updates the
Postgres
plugin for thedbt-duckdb
adapter to align with the latest DuckDB PostgreSQL extension (ATTACH
syntax) and introduces improvements to functionality, testing, and error handling.Changes Made:
Migration to
ATTACH
Syntax:CALL postgres_attach
syntax with the newATTACH
command, returning the write-to-pg functionality.overwrite
in favor ofREAD_ONLY
.Enhanced Configuration:
Improved Logging and Debugging:
AdapterLogger
to provide clearer and more detailed error messages.Updated Unit Tests:
ATTACH
with default and custom configurations.Code Refactoring:
_set_extension_settings
,_build_attach_statement
).Testing:
1.1.3
.Impact:
Checklist:
postgres.py
to supportATTACH
syntax.test_postgres.py
to reflect new features and configurations.Related Issues:
Unfortunately, due to this issue the testing has to be done outside the VSCode dev container.
478
Please review the changes and let me know if additional updates or refinements are needed. Thank you for your time and consideration!🚀