Migration to SQLAlchemy 2.0 and Python 3.10+#326
Merged
Conversation
6 tasks
4 tasks
There was a problem hiding this comment.
Pull request overview
Updates the project to target SQLAlchemy 2.x and Python 3.10+, removing legacy compatibility shims and modernizing dialect/reflection code plus tests to match the SQLAlchemy 2.0 API surface.
Changes:
- Upgrade runtime/test tooling to SQLAlchemy 2.0 and Python >=3.10; refresh tox/docs/lint dependencies.
- Refactor the Redshift dialect reflection/DDL/command compilation logic for SQLAlchemy 2.0 (including multi-reflection behavior and type reflection).
- Update and reformat the test suite to SQLAlchemy 2.0 query APIs and current Python style; remove the legacy
redshift_sqlalchemycompatibility package.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Updates tox env matrix and pins newer test/lint/docs dependencies. |
| setup.py | Sets python_requires>=3.10, upgrades SQLAlchemy requirement to 2.x, removes legacy package, adds extras. |
| setup.cfg | Adds isort/flake8 config and attempts to add Black config. |
| requirements-docs.txt | Updates Sphinx/numpydoc and doc build dependencies. |
| sqlalchemy_redshift/init.py | Switches version detection to importlib.metadata and updates dialect registrations. |
| sqlalchemy_redshift/dialect.py | Major SQLAlchemy 2.0 compatibility updates for reflection, types, DBAPI import, and compiler behavior. |
| sqlalchemy_redshift/ddl.py | Modernizes DDL helpers/compilers and string formatting for 2.0-era SQLAlchemy. |
| sqlalchemy_redshift/commands.py | Modernizes command construction/compilation and formatting; removes legacy compatibility branches. |
| redshift_sqlalchemy/init.py | Removes the legacy compatibility module package. |
| docs/conf.py | Reformats/modernizes Sphinx config (but retains old intersphinx mapping). |
| .gitignore | Adds common local dev artifacts (.python-version, .vscode). |
| tests/conftest.py | Fixes --dbdriver default handling and modernizes fixtures/style. |
| tests/rs_sqla_test_utils/utils.py | Updates compilation helpers for SQLAlchemy 2.0; adds string passthrough in compile_query. |
| tests/rs_sqla_test_utils/models.py | Migrates to declarative_base() and updates model/table args for 2.0 style. |
| tests/rs_sqla_test_utils/db.py | Updates engine definition helper and driver-specific connect args. |
| tests/test_alembic_dialect.py | Updates alembic dialect tests for new formatting/import ordering. |
| tests/test_alter_table.py | Updates tests and formatting; keeps behavior assertions. |
| tests/test_column_loading.py | Updates column reflection tests for 2.0 API and formatting. |
| tests/test_compiler.py | Updates select() invocation to SQLAlchemy 2.0 positional args syntax. |
| tests/test_constraint_names.py | Updates assertion/style and call formatting. |
| tests/test_copy_command.py | Updates COPY command tests to 2.0 select() syntax and modern formatting. |
| tests/test_create_library.py | Updates CREATE LIBRARY tests and modernizes string handling. |
| tests/test_ddl_compiler.py | Modernizes DDL compiler tests (but introduces a Python 3-incompatible debug helper). |
| tests/test_default_ssl.py | Switches cert path resolution to importlib.resources. |
| tests/test_delete_stmt.py | Modernizes delete compilation tests to 2.0 select() style and formatting. |
| tests/test_dialect_types.py | Updates type tests and reflection inspection for SQLAlchemy 2.0 APIs. |
| tests/test_dialects.py | Removes legacy redshift_sqlalchemy-based assertions and keeps dialect inheritance checks. |
| tests/test_get_table_attributes.py | Modernizes parameterization and imports; keeps DDL attribute assertions. |
| tests/test_materialized_views.py | Updates MV tests to SQLAlchemy 2.0 select() patterns and selectable handling. |
| tests/test_reflection.py | Updates reflection tests for autoload_with / unbound MetaData() usage. |
| tests/test_reflection_views.py | Updates view reflection tests for SQLAlchemy 2.0 autoloading and formatting. |
| tests/test_relationkey_unquoted.py | Refactors parametrization/style only. |
| tests/test_simple_query.py | Updates string quoting/style only. |
| tests/test_unload_from_select.py | Updates UNLOAD tests to SQLAlchemy 2.0 select() syntax and modern formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary