Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions autoload/db_ui/schemas.vim
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ if !exists('g:db_adapter_sqlite3')
let g:db_adapter_sqlite3 = 'db#adapter#sqlite#'
endif

if !exists('g:db_adapter_duckdb')
let g:db_adapter_duckdb = 'db#adapter#duckdb#'
Copy link
Owner

Choose a reason for hiding this comment

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

Don't we also need an entry in s:schemas above to get the tables metadata?

endif


function! db_ui#schemas#get(scheme) abort
return get(s:schemas, a:scheme, {})
endfunction
Expand Down
9 changes: 9 additions & 0 deletions autoload/db_ui/table_helpers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ let s:sqlserver = {
\ 'Describe': 'exec sp_help ''{schema}.{table}''',
\ }

let s:duckdb = {
\ 'List': g:db_ui_default_query,
\ 'Columns': "SELECT column_name, data_type, is_nullable, column_default FROM temp.information_schema.columns WHERE table_name = '{table}'",
\ 'Indexes': "SELECT * FROM duckdb_indexes() WHERE table_name = '{table}'",
\ 'Foreign Keys': "SELECT * FROM duckdb_constraints() WHERE table_name = '{table}' AND constraint_type = 'FOREIGN KEY'",
\ 'Primary Keys': "SELECT * FROM duckdb_constraints() WHERE table_name = '{table}' AND constraint_type = 'PRIMARY KEY'"
\ }

let s:helpers = {
\ 'bigquery': s:bigquery,
\ 'postgresql': s:postgres,
Expand All @@ -191,6 +199,7 @@ let s:helpers = {
\ 'sqlite': s:sqlite,
\ 'sqlserver': s:sqlserver,
\ 'mongodb': { 'List': '{table}.find()'},
\ 'duckdb': s:duckdb,
\ }

let s:all = {}
Expand Down