fix: ensure compatibility with pandas>=2.0 by using SQLAlchemy Connection in read_sql #90
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.
Overview
✅ Extended Postgres Type Support: The
_type_lookupnow explicitly supports all relevant pandas and PostgreSQL types, includingInt64,boolean,string, andJSONB, improving robustness and compatibility.✅ Fixes COPY failures: Prevents silent data truncation or mismatched writes by ensuring pandas
float64is handled when writing toInt64columns using PostgresCOPY.✅ Improved Error Transparency:
_generate_model_from_schemanow skips columns only if they lack a compatible mapping — consider extending to raise if critical fields are dropped.✅ Improved pandas 2.x Compatibility: Replaced
session.get_bind()with compiled SQL usingsqlalchemy.text(...)for pandas ≥ 2.0.✅ Cleaner Logging: Log messages for table reads now include database host and name for easier traceability.
✅ Tests Updated:
ReadOnlyColumnCollection(SQLAlchemy 2.x).GenericIOtest schema to verify full mixin functionality.✅ Pre-commit Fixes:
excludefields (e.g.,demo/*→demo/.*).committopre-commit.pre-commit migrate-configand updated Makefile accordingly.Checklist
The following won't apply in all cases - mark
N/Anext to point if not needed.Release-Steps