Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Improve read_database interop with sqlalchemy Session and various Result objects #14557

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Feb 17, 2024

Closes #13926.

Further streamlines use of read_database by ensuring seamless interop with SQLAlchemy's Session and various Result objects (we were mostly fine, but some specific flavours of cursor result needed additional introspection to determine what columns were being returned).

  • Improves column inference from cursor/result object (eg: ChunkedIteratorResult, as seen in the linked issue).
  • Adds explicit test coverage for SQLAlchemy's Session object.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Feb 17, 2024
Copy link

codecov bot commented Feb 17, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (815732b) 80.76% compared to head (01e323d) 80.78%.

Files Patch % Lines
py-polars/polars/io/database.py 88.88% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14557      +/-   ##
==========================================
+ Coverage   80.76%   80.78%   +0.01%     
==========================================
  Files        1326     1326              
  Lines      173035   173043       +8     
  Branches     2439     2443       +4     
==========================================
+ Hits       139758   139793      +35     
+ Misses      32805    32778      -27     
  Partials      472      472              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit e40140f into pola-rs:main Feb 18, 2024
14 checks passed
@alexander-beedie alexander-beedie deleted the improve-alchemy-session-interop branch February 18, 2024 04:24
@alexander-beedie alexander-beedie changed the title feat(python): improve read_database interop with sqlalchemy Session connections feat(python): improve read_database interop with sqlalchemy Session and various Result objects Feb 18, 2024
@stinodego stinodego changed the title feat(python): improve read_database interop with sqlalchemy Session and various Result objects feat(python): Improve read_database interop with sqlalchemy Session and various Result objects Feb 19, 2024
@alexander-beedie alexander-beedie added the A-io-database Area: reading/writing to databases label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-io-database Area: reading/writing to databases enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_database + Sqlalchemy2 = 'ChunkedIteratorResult' object has no attribute 'cursor' when using the ORM
2 participants