From f7f25f39c946c4a5a4224ecab4a0d6c4af09aead Mon Sep 17 00:00:00 2001 From: Kyle Foreman Date: Tue, 26 Feb 2019 16:25:33 -0800 Subject: [PATCH] add Snowflake (snowsql) support and give an example configuration --- SQLTools.sublime-settings | 33 +++++++++++++++++++++++++++- SQLToolsConnections.sublime-settings | 10 +++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/SQLTools.sublime-settings b/SQLTools.sublime-settings index 4ab40e7..cef937d 100644 --- a/SQLTools.sublime-settings +++ b/SQLTools.sublime-settings @@ -15,7 +15,8 @@ "sqlite" : "sqlite3", "vertica" : "vsql", "firebird": "isql", - "sqsh" : "sqsh" + "sqsh" : "sqsh", + "snowsql" : "snowsql" }, // If there is no SQL selected, use "expanded" region. @@ -511,6 +512,36 @@ "before": ["\\set semicolon_cmd=\"\\go -mpretty -l\""] } } + }, + + "snowsql": { + "options": [], + "args": "-u {user} -a {account} -d {database} --authenticator {auth} -K", + "queries": { + "execute": { + "options": [], + }, + "show records": { + "query": "SELECT * FROM {0} LIMIT {1};" + }, + "desc table": { + "query": "DESC TABLE {0};", + "options": ["-o", "output_format=plain", + "-o", "timing=False"] + }, + "desc": { + "query": "SELECT TABLE_SCHEMA || '.' || TABLE_NAME AS tbl FROM INFORMATION_SCHEMA.TABLES;", + "options": ["-o", "output_format=plain", + "-o", "header=False", + "-o", "timing=False"] + }, + "columns": { + "query": "SELECT TABLE_NAME || '.' || COLUMN_NAME AS col FROM INFORMATION_SCHEMA.COLUMNS", + "options": ["-o", "output_format=plain", + "-o", "header=False", + "-o", "timing=False"] + } + } } } } diff --git a/SQLToolsConnections.sublime-settings b/SQLToolsConnections.sublime-settings index 0f3c127..fcd5abf 100644 --- a/SQLToolsConnections.sublime-settings +++ b/SQLToolsConnections.sublime-settings @@ -82,6 +82,16 @@ // note the forward slashes (if path is used) "database": "c:/firebird/examples/empbuild/employee.fdb", "encoding": "utf-8" + }, + "Connection Snowflake": { + "type" : "snowsql", + "database": "database", + // for possible authentication configurations see + // https://docs.snowflake.net/manuals/user-guide/snowsql-start.html#authenticator + // if using "snowflake", need to set SNOWSQL_PWD environment variable + "user" : "user@example.com", + "account" : "account_name", + "auth": : "snowflake | externalbrowser | " } */ },