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

fix(python): Check for duplicate column names in read_database cursor result, raising DuplicateError if found #18548

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Sep 4, 2024

Closes #18526 👍

We now raise a proper DuplicateError if/when the database result cursor contains multiple instances of the same column name; currently we map the cursor description to a Schema dict without checking for this, which eats any duplicates - this then goes on to raise a much less obvious error later.

…or result, raising `DuplicateError` if found
@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Sep 4, 2024
@alexander-beedie alexander-beedie added the A-io-database Area: reading/writing to databases label Sep 4, 2024
Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.80%. Comparing base (af8738c) to head (56df1ed).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
py-polars/polars/io/database/_executor.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18548      +/-   ##
==========================================
- Coverage   79.82%   79.80%   -0.03%     
==========================================
  Files        1502     1502              
  Lines      201933   201938       +5     
  Branches     2868     2869       +1     
==========================================
- Hits       161201   161161      -40     
- Misses      40186    40231      +45     
  Partials      546      546              

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

@ritchie46 ritchie46 merged commit 242d30a into pola-rs:main Sep 5, 2024
17 checks passed
@alexander-beedie alexander-beedie deleted the raise-dbcursor-duplicate-cols branch September 5, 2024 10:54
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 fix Bug fix python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema inference fails when colums are produced without a name with pyodbc and sql server
2 participants