snowflake connection
Hi, I can't seem to make the snowflake connection work, does the name in the connections.json needs to match the connection name in the snowflake config.toml file for snowql to take it automatically? or how's does that automation happens, should a pop up appear when I try to open a snowflake connection?.
Thanks
The connections.json should have snowflake as the url field (allowing the snowsql client to handle the rest), and name can be anything you want. It should be using a connections.private_key_path within the config.
Here is what mine looks like: snowsql config
[connections]
accountname="abc123.us-west-2"
username="me"
dbname="mydb"
warehousename="wh"
private_key_path="/path/to/key.p8"
connections.json
{
"url": "snowflake",
"name": "snowflake"
}
Are you getting any errors, or is it just unable to connect in general?
oh, @Xemptuous thank you very much, in my case I was using the snowflake config file an not the snowsql config file, changing it works.
Another question, how does it handle multiple connections in my snowsql config file? currently I have a connection per environment , do I need to to create multiple connections in the connection.json file?
the snowflake connections now rocks but when I tried to open any of my DBs I get the following error:
Does this only works if I specified the database in my connection? if my role supports multiple DBs does it work?
how does it handle multiple connections in my snowsql config file? currently I have a connection per environment , do I need to to create multiple connections in the connection.json file?
I think currently, it only supports a single connection atm. I only have access to 1 SF db, so I designed it around that. It should be possible to incorporate more than one.
Does snowsql config allow multiple instances to be connected to simultaneously via snowsql cli?
Does this only works if I specified the database in my connection? if my role supports multiple DBs does it work?
This error looks like it could be a potential bug. When expanding the snowflake db in the sidebar by pressing <CR> on it, it should show Loading, and after a few seconds it should have loaded up all the databases available (plus schemas, tables, etc.). Are you using nvim 10.0.0+ and the most updated version of sqlua.nvim?
Maybe it has to do with the multiple db's available; try with a single one and lmk if that works.
Hi @Xemptuous , thanks for the reply.
Does snowsql config allow multiple instances to be connected to simultaneously via snowsql cli?
snowsql works with multiple connections because you can specify the connection with the --c parameter.
Are you using nvim 10.0.0+ and the most updated version of sqlua.nvim?
Yes, nvim version is v0.11.1 and becasue I'm using LazyVim I guess i'n using the latest sqlua.
Thanks
I see, so this looks to be a 2 parter.
First bug
First, your error might be a bug, as it's trying to find the db in the sidebar, but unable to find it. I am unable to reproduce, so can you share a screenshot of your sidebar where you try and select the DB with <CR>, as well as the full error from :messages?
Multiple selections
so to help me make sure I understand:
We can have separate connections specified in the config toml like this:
[connections]
# Default connection params here
[connections.mycon1]
# ...
[connections.mycon2]
# ...
And then we can connect to a specified one using snowsql -c mycon1 or snowsql --connection mycon2, right?
If that's the case, we can update the connections.json entry for snowflake to allow separate entries for separate connections.
Maybe something like this:
{
"name": "snowflake-default"
"url": "snowsql"
},
{
"name": "snowflake-con2"
"url": "snowsql/connection=mycon2"
}
So that we can use the default connection, but also another one to pass the -c arg when running the queries?
Otherwise, I think it will only use the [connections] defaults, and you'd have to change the config each time, which is annoying. I don't have access to multiple connections, so I might not be able to get it fully working, but I can make the branch and changes and maybe you can test it out and make sure it works? Lmk what you think
Hey, I'm also on Snowflake and running into the same issue when trying to open up a DB.
Here is the full error message:
E5108: Error executing lua: ...hager/.local/share/nvim/lazy/sqlua.nvim/lua/sqlua/ui.lua:358: bad argument #1 to 'find' (string expected, got nil)
stack traceback:
[C]: in function 'find'
...hager/.local/share/nvim/lazy/sqlua.nvim/lua/sqlua/ui.lua:358: in function 'snowflake_db'
...hager/.local/share/nvim/lazy/sqlua.nvim/lua/sqlua/ui.lua:843: in function 'toggleSelectionUnderCursor'
...hager/.local/share/nvim/lazy/sqlua.nvim/lua/sqlua/ui.lua:1208: in function <...hager/.local/share/nvim/lazy/sqlua.nvim/lua/sqlua/ui.lua:1187>