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

[SQL] Allow for running of SQL on the Python global() namespace #2740

Closed
jaychia opened this issue Aug 27, 2024 · 2 comments · Fixed by #2864
Closed

[SQL] Allow for running of SQL on the Python global() namespace #2740

jaychia opened this issue Aug 27, 2024 · 2 comments · Fixed by #2864

Comments

@jaychia
Copy link
Contributor

jaychia commented Aug 27, 2024

example:

df = daft.read_parquet('some/file')

daft.sql('select * from df').collect()
@amitschang
Copy link
Contributor

I have a small change that implements this within the python daft.sql function - by using inspect, walking back to the caller frame and getting globals/locals from there to build a catalog in the case that no catalog is supplied. If you think that is a reasonable approach I can prepare a PR. Thanks!

@universalmind303
Copy link
Collaborator

I have a small change that implements this within the python daft.sql function - by using inspect, walking back to the caller frame and getting globals/locals from there to build a catalog in the case that no catalog is supplied. If you think that is a reasonable approach I can prepare a PR. Thanks!

yes feel free to open up a PR! happy to review it.

universalmind303 pushed a commit that referenced this issue Sep 23, 2024
This builds a catalog based on the python globals and locals visible to
the caller at the point where the `sql` query function is called, in the
case where a catalog is not supplied. Otherwise, the catalog is final
and must contain necessary tables.

resolves #2740
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants