feat: Snowflake adapter using show statements
rebased https://github.com/kndndrj/nvim-dbee/pull/109 on master and updated it to use show commands to avoid waking warehouses to prevent extra cost
im not a go dev, but tried my best to follow the patterns i saw as much as possible
i couldn't figure out a way to do show databases and get the current without 2 queries and that seemed to cause issues, so I left that one in there as I assume it happens much less frequently than structure and columns.
If anybody knows how i could do that, happy to add it.
Hi @derekbunch sorry for slow response, feel free to ping me for faster help :)
Is this ready for review? We are currently focusing on adding somewhat integration tests for existing adapters. Ideally, any new adapter should also try to follow this structure.
We are using testcontainers as the tool for testing each adapter. From quickly checking, it seem there is a localstack image https://hub.docker.com/r/localstack/snowflake (edit: and testcontainer: https://golang.testcontainers.org/modules/localstack/) that you can use to emulate the snowflake warehouse locally. Could you try and take a stab adding this into this PR as well? It would be very much appreciated as it simplifies testing and debugging quite a lot. Let me know if you need any help with this!
Hi @MattiasMTS, yes it should be ready for review.
And no problem. ill look into the links you shared and try to get those tests implemented for this MR.
Hi @derekbunch sorry for slow response, feel free to ping me for faster help :)
Is this ready for review? We are currently focusing on adding somewhat integration tests for existing adapters. Ideally, any new adapter should also try to follow this structure.
We are using testcontainers as the tool for testing each adapter. From quickly checking, it seem there is a localstack image https://hub.docker.com/r/localstack/snowflake (edit: and testcontainer: https://golang.testcontainers.org/modules/localstack/) that you can use to emulate the snowflake warehouse locally. Could you try and take a stab adding this into this PR as well? It would be very much appreciated as it simplifies testing and debugging quite a lot. Let me know if you need any help with this!
@MattiasMTS I've looked into this a bit and tried to get it set up. Looks like it needs an auth token to run the container so I created an account, generated an auth token, and tried to run the container with it and it gives me this error
❯docker run \
--rm -it \
-p 127.0.0.1:4566:4566 \
-p 127.0.0.1:4510-4559:4510-4559 \
-p 127.0.0.1:443:443 \
-e LOCALSTACK_AUTH_TOKEN="<redacted>" \
localstack/snowflake
LocalStack version: 4.2.1.dev76
LocalStack build date: 2025-03-20
LocalStack build git hash: 6b2781950
Docker not available
2025-03-22T05:51:45.089 INFO --- [ MainThread] l.p.c.b.licensingv2 : Successfully requested and activated new license <redacted>:hobby 🔑✅
2025-03-22T05:51:47.017 INFO --- [ MainThread] l.p.c.extensions.platform : loaded 1 extensions
⚠ The Snowflake emulator is currently not covered by your license. ❄ Please reach out to LocalStack Support to get access to this product. ⚠
Any idea how i should proceed? Do y'all use a ci token for your ci where this would run or is this a non-starter?
Any idea how i should proceed? Do y'all use a ci token for your ci where this would run or is this a non-starter?
ahh, right. I guess that version of localstack requires a subscription.. That is a bit unfortunate. Feel free to skip this part/scope of this PR then and I'll try and find if we can get a sub based on OSS stuff. Thanks a lot for trying it out and feedback the info! 😄