Skip to content

feat: Snowflake adapter - #109

Open
oliverlambson wants to merge 1 commit into
kndndrj:masterfrom
oliverlambson:feat/snowflake
Open

feat: Snowflake adapter#109
oliverlambson wants to merge 1 commit into
kndndrj:masterfrom
oliverlambson:feat/snowflake

Conversation

@oliverlambson

@oliverlambson oliverlambson commented May 2, 2024

Copy link
Copy Markdown

Closes #23

Implemented a Snowflake adapter using gosnowflake.

Steps followed

  1. Add gosnowflake dependency:
    go get -u github.com/snowflakedb/gosnowflake@latest
    This changed a lot of go.mod and I have no idea if that's expected behaviour (I assumed it would only add required deps, but it seems to have bumped a bunch of versions too. I'm not a go dev, sorry)
  2. Use Redshift adapter files as base templates and modify to work with gosnowflake
  3. Update SQL queries for Driver and Helpers
  4. Test locally in nvim-dbee
    I did this by building the binary (go build) and replacing the default binary that the nvim-dbee lua config points to (in my case at /Users/oliverlambson/.local/share/nvim/dbee/bin/dbee, I'm on an M1 Mac)

Manual testing

(sorry had to redact everything because I don't have a dummy snowflake to play with)

image

@oliverlambson oliverlambson changed the title feat: Add Snowflake adapter feat: Snowflake adapter May 2, 2024
@oliverlambson
oliverlambson force-pushed the feat/snowflake branch 3 times, most recently from 2f4e993 to be8c26f Compare May 2, 2024 15:43

@AM-I-Human AM-I-Human left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hello, I'm not a maintainer but I have some suggestion to improve it (maybe). It involves the use of SHOW instead of SELECTS to avoid waking up warehouses

Comment on lines +62 to +67
SELECT column_name, data_type
FROM information_schema.columns
WHERE
table_schema=UPPER('%s') AND
table_name=UPPER('%s')
ORDER BY ordinal_position

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think it is better to use SHOW as command
to avoid warehouse costs https://docs.snowflake.com/en/sql-reference/sql/show-columns

Comment on lines +76 to +87
SELECT
table_schema AS schema_name
, table_name
, CASE
WHEN table_type = 'BASE TABLE' THEN 'TABLE'
ELSE table_type
END AS table_type
FROM
information_schema.tables
WHERE
table_schema NOT IN ('INFORMATION_SCHEMA', 'PG_CATALOG')
AND table_catalog = CURRENT_DATABASE();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Slanman3755

Copy link
Copy Markdown

Bumping this. What would it take to get this merged?

@ArthurMynl

Copy link
Copy Markdown

Re bumping it, as a data engineer I would love to be able to use snowflake inside neovim :)

@SergioQuijanoRey

Copy link
Copy Markdown

Re bumping it, as a data engineer I would love to be able to use snowflake inside neovim :)

Totally agree with this!

@phdah

phdah commented Feb 14, 2025

Copy link
Copy Markdown
Contributor

Hey @oliverlambson!

The plugin has been stale for some time, but we have actively started doing work again.
Would you mind syncing you branch, and looking over possible needed changes? Me and @MattiasMTS are pushing for a v0.2.0 release, where the focus is integration tests for the existing adapters. See discussion

Then we would be happy to review this PR.

@oliverlambson

oliverlambson commented Feb 14, 2025

Copy link
Copy Markdown
Author

@phdah i actually don't use snowflake anymore (and don't even have access to a warehouse since leaving my previous job)

perhaps @AM-I-Human, @Slanman3755, @ArthurMynl or @SergioQuijanoRey would like to pick it up?

@derekbunch

Copy link
Copy Markdown

I've actually also been working on my own fork that's rebased on top of master and trying to get show commands working (since it doesn't match the [name, data type] column order of ColumnsFromResultStream) but I'm also not a go dev so it's slow going.

I'd be willing to try and help this get across the line if needed.

@riza-khan

Copy link
Copy Markdown

+1 this would be useful!

vanducng added a commit to vanducng/nvim-dbee that referenced this pull request Jun 8, 2025
- Implement comprehensive Snowflake database adapter
- Support for password, keypair (JWT), and MFA/SSO authentication methods
- Private key loading with PKCS1/PKCS8 format support and encryption
- Cost-optimized queries using SHOW statements to avoid warehouse wake-up
- Database operations: structure browsing, column metadata, database switching
- Complete unit test suite with authentication method validation
- Documentation with setup guide and troubleshooting
- Environment variable template support for secure credential management

Addresses: kndndrj#23, builds on kndndrj#109 and kndndrj#186
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.

request: snowflake driver

8 participants