-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Tim Pope <code@tpope.net>
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function! db#adapter#snowflake#interactive(url) abort | ||
let url = db#url#parse(a:url) | ||
let cmd = (has_key(url, 'password') ? ['env', 'SNOWSQL_PWD=' . url.password] : []) + | ||
\ ["snowsql"] + | ||
\ db#url#as_argv(a:url, '-a ', '', '', '-u ', '','-d ') | ||
for [k, v] in items(url.params) | ||
call add(cmd, '--' . k . '=' . v) | ||
endfor | ||
return cmd | ||
endfunction | ||
|
||
function! db#adapter#snowflake#filter(url) abort | ||
return db#adapter#snowflake#interactive(a:url) + | ||
\ ['-o', 'friendly=false', '-o', 'timing=false'] | ||
endfunction | ||
|
||
function! db#adapter#snowflake#input(url, in) abort | ||
return db#adapter#snowflake#filter(a:url) + ['-f', a:in] | ||
endfunction | ||
|
||
function! db#adapter#snowflake#complete_opaque(url) abort | ||
return db#adapter#snowflake#complete_database(url) | ||
endfunction | ||
|
||
function! db#adapter#snowflake#complete_database(url) abort | ||
let pre = matchstr(a:url, '[^:]\+://.\{-\}/') | ||
let cmd = db#adapter#snowflake#filter(pre) + | ||
\ ['-o', 'header=false', '-o', 'output_format=tsv'] + | ||
\ ['-q', 'show terse databases'] | ||
return map(db#systemlist(cmd), { _, v -> split(v, "\t")[1] }) | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters