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(snowflake): properly pass schema and database for sqlglot generation #9221

Merged
merged 2 commits into from
May 22, 2024

Conversation

dlovell
Copy link
Contributor

@dlovell dlovell commented May 21, 2024

Description of changes

  • split database and schema to pass to sqlglot for proper full name qualification
  • conditionally include use_stmt to prevent invalid USE SCHEMA statement when

currently use_stmt is generated like 'USE SCHEMA "DATABASE/SCHEMA"', it should be 'USE SCHEMA "DATABASE"."SCHEMA"'

Copy link
Member

@gforsyth gforsyth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this in @dlovell !

Small naming nit -- I just spent a long time eliminating the use of the word schema in the hierarchical sense (although I missed this bit, thanks for flagging it!). I think the fix here is good, I just want to make sure that grepping for schema across the codebase returns name->type mappings

ibis/backends/snowflake/__init__.py Outdated Show resolved Hide resolved
dlovell and others added 2 commits May 22, 2024 07:19
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
@dlovell dlovell force-pushed the fix-snowflake-setup-session branch from f4a89e1 to 018a0fd Compare May 22, 2024 11:19
@gforsyth
Copy link
Member

Snowflake tests passing:

🐚 just test snowflake
bringing up nodes...
........x...x..x..xx..........xx.x...x..x..................................x. [  4%]
.............s.s.....................................................xxx..... [  9%]
......x...........s.......................................x.x................ [ 13%]
...............x...........................................xx....xxxxxxx.xx.. [ 18%]
x............x.x.......x.x........................xx..........x............x. [ 22%]
..............x...xx..x.................x.............x.....x..x.........x..x [ 27%]
x..............xx....x...x.............x.............x..................x.... [ 31%]
.................x.............................x..............x....xx........ [ 36%]
......x....x.x....x.x..x.x.....xx..xx.....x......x...x...xx.x....x........x... [ 40%]
....xx........................................x..x.......x....x.....s..x..... [ 45%]
.......x.........x........................................................... [ 49%]
.....................xxxxxxxxx.x.x......xx.x.....x...................x....... [ 54%]
.......x.......x.............................x....................x.x........ [ 58%]
...................x......x......x....x.xx..........s..x....xx............... [ 63%]
.......x.x.....x..xxxx....x..x.x.x.......xxx...x..x.xx....x.xxxx.........xx.x [ 68%]
x.xxx.x.xxxxxx..x.x..x..xxxx.x.xx.xx.....xx.xx.x..xxx.x.xxxx..x.x.x..x..x.... [ 72%]
.......s.x......................x............................x.....x...x..... [ 77%]
....x..x.....x..x.............x.............x..x.......x..x.................. [ 81%]
............x....x.......................x.....x.........x......x...x........ [ 86%]
.x.........xxx.x........s.x......x........................................... [ 90%]
.............................................................................. [ 95%]
................................................ss........................... [ 99%]
....                                                                          [100%]
1477 passed, 9 skipped, 214 xfailed in 115.11s (0:01:55)

We should probably have a test for this so we don't regress -- I'll try to sort that out in a followup

@gforsyth gforsyth merged commit 1ecb319 into ibis-project:main May 22, 2024
81 of 82 checks passed
@gforsyth
Copy link
Member

Thanks for the fix @dlovell !

gforsyth added a commit to gforsyth/ibis that referenced this pull request May 22, 2024
xref ibis-project#9221

We weren't handling passing in `catalog/database` as the `database`
kwarg, despite our documentation telling users to do that.

This was fixed in the above PR -- here I'm adding a (very gross) test to
ensure that both connection methods work.
gforsyth added a commit to gforsyth/ibis that referenced this pull request May 22, 2024
xref ibis-project#9221

We weren't handling passing in `catalog/database` as the `database`
kwarg, despite our documentation telling users to do that.

This was fixed in the above PR -- here I'm adding a (very gross) test to
ensure that both connection methods work.
gforsyth added a commit that referenced this pull request May 22, 2024
xref #9221

We weren't handling passing in `catalog/database` as the `database`
kwarg, despite our documentation telling users to do that.

This was fixed in the above PR -- here I'm adding a test to
ensure that both connection methods work.
mesejo pushed a commit to letsql/letsql that referenced this pull request May 31, 2024
* test: add test of issues with ibis' snowflake connection as of 9.0.0
* fix(snowflake): monkeypatch snowflake setup
* add a hotfix for proper snowflake connection initialization (pending next release that includes fix(snowflake): properly pass schema and database for sqlglot generation ibis-project/ibis#9221)
* add a test for the expectation of initial snowflake connection state re catalog/database based on create_object_udfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants