-
Notifications
You must be signed in to change notification settings - Fork 590
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(polars): add limited support for table dot sql #8528
Conversation
|
this at least works for the simple example I want to use in docs: [ins] In [1]: import ibis
[ins] In [2]: ibis.options.interactive = True
[ins] In [3]: ibis.set_backend("polars")
[ins] In [4]: t = ibis.examples.penguins.fetch()
[ins] In [5]: t
Out[5]:
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ body_mass_g ┃ sex ┃ year ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ string │ string │ float64 │ float64 │ int64 │ int64 │ string │ int64 │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼─────────────┼────────┼───────┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ 3750 │ male │ 2007 │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ 3800 │ female │ 2007 │
│ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ 3250 │ female │ 2007 │
│ Adelie │ Torgersen │ NULL │ NULL │ NULL │ NULL │ NULL │ 2007 │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ 3450 │ female │ 2007 │
│ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ 3650 │ male │ 2007 │
│ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ 3625 │ female │ 2007 │
│ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ 4675 │ male │ 2007 │
│ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ 3475 │ NULL │ 2007 │
│ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ 4250 │ NULL │ 2007 │
│ … │ … │ … │ … │ … │ … │ … │ … │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴─────────────┴────────┴───────┘
[ins] In [6]: t.sql("SELECT species, island, count(*) AS count FROM penguins GROUP BY species, island")
Out[6]:
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┓
┃ species ┃ island ┃ count ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━┩
│ string │ string │ uint32 │
├───────────┼───────────┼────────┤
│ Chinstrap │ Dream │ 68 │
│ Adelie │ Torgersen │ 52 │
│ Gentoo │ Biscoe │ 124 │
│ Adelie │ Biscoe │ 44 │
│ Adelie │ Dream │ 56 │
└───────────┴───────────┴────────┘ |
|
@lostmygithubaccount That only works because the examples |
|
I guess for the docs example it's fine. It might be good to call out the lack of SQL support in |
|
yeah it's fine for the docs...if users run into issues we can point to the Polars issue(s) on SQL support |
|
Ugh, this fails because Polars doesn't respect/allow/handle quoted identifiers. |
|
CTEs are implemented but a table with name |
1c4306b
to
8a868a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to have a proper engineer review the code but looks fine to me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, question about dependencies (our favorite!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few thoughts, but they can be done in a follow-up:
- I think we should have some kind of
try exceptimport check, so we can raise a helpful error message since a user using thepolarsbackend might get thrown by having an "unrelated" import error forpsycopg2. - Because
psycopg2can be a pain to install (forpipusers, at least), does this have to make use of thepostgrescompiler? Wouldduckdbwork? Becauseduckdbwould always be installed anyway. And that would remove the need for point 1 above, now that I'm thinking about it.
|
The Given that we're not installing the With that, is there anything to follow up with? |
|
You've got an XPASS in the exasol test suite, but other than that |
Adds limited support for
.sqlto the Polars backend. Closes #8525.