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: Improve read_csv SQL table reading function defaults (better handle dates) #16866

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Jun 11, 2024

Several modest improvements to SQL table-read function:

  • Sets "try_parse_dates=True" by default for read_csv.
  • Raises a SQLSyntax error if more than one argument is passed (all read funcs).
  • Adds extra test coverage (null vs empty string, dates) for CSV reads from SQL.

Example

df = pl.sql(f"SELECT * FROM read_csv('some_file.csv')").collect()

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Jun 11, 2024
@alexander-beedie alexander-beedie added the A-sql Area: Polars SQL functionality label Jun 11, 2024
Copy link

codecov bot commented Jun 11, 2024

Codecov Report

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

Project coverage is 81.33%. Comparing base (13d68ae) to head (2841c92).

Files Patch % Lines
crates/polars-sql/src/table_functions.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16866      +/-   ##
==========================================
- Coverage   81.36%   81.33%   -0.03%     
==========================================
  Files        1425     1425              
  Lines      187910   187913       +3     
  Branches     2705     2705              
==========================================
- Hits       152885   152846      -39     
- Misses      34529    34571      +42     
  Partials      496      496              

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

@ritchie46 ritchie46 merged commit d4462f7 into pola-rs:main Jun 11, 2024
33 checks passed
@alexander-beedie alexander-beedie deleted the sql-read-csv-dates branch June 11, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql Area: Polars SQL functionality enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants