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: Support SQL "SELECT" with no tables, optimise registration of globals #16836

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

alexander-beedie
Copy link
Collaborator

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

Closes #16826.

  • Allows SQL queries of the form SELECT 1 AS "one", 2.0 AS "two" (eg: project literals without reference to an existing table)1.

Also:

  • Improves/streamlines use of SQLContext with globals (cleaner/better handling of reserved SQL keywords).
  • Removes a potential SQLContext footgun; can only automatically register non-Polars globals via pl.sql or SQLContext.execute_global now; this ensures that we only register objects referenced in an actual query.

Footnotes

  1. PostgreSQL "SELECT" syntax: https://www.postgresql.org/docs/current/sql-select.html#:~:text=SELECT%20retrieves%20rows%20from%20zero%20or%20more%20tables.

@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 9, 2024
@alexander-beedie alexander-beedie added the A-sql Area: Polars SQL functionality label Jun 9, 2024
Copy link

codecov bot commented Jun 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.36%. Comparing base (c81ef69) to head (9a8ce01).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16836      +/-   ##
==========================================
- Coverage   81.38%   81.36%   -0.02%     
==========================================
  Files        1425     1425              
  Lines      187606   187612       +6     
  Branches     2697     2697              
==========================================
- Hits       152677   152649      -28     
- Misses      34434    34468      +34     
  Partials      495      495              

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

@ritchie46 ritchie46 merged commit 92af769 into pola-rs:main Jun 10, 2024
30 checks passed
@alexander-beedie alexander-beedie deleted the sql-select-from-nothing branch June 10, 2024 07:03
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.

suggest sql add select sth without a from syntax
2 participants