Export/import/share DuckDB UI Notebooks
The DuckDB UI stores notebook content in an internal database called _duckdb_ui. You can query and export notebook content, as well as insert new definitions into the database. Warning: Modifying the internal database may lead to corruption and data loss. Be cautious and use it at your own risk!
Export a notebook definition to JSONSQL
copy ( select "json" from _duckdb_ui.notebook_versions where 1=1 and title = 'MySingleNotebook' and expires is null ) to 'exported-notebook.json'
Copy code
Import notebook definitionSQL
set variable notebook_content = (select json from 'exported-notebook.json'); set variable notebook_id = uuid(); set variable current_timestamp = now(); begin transaction; insert into _duckdb_ui.notebooks (id, name, created) select getvariable('notebook_id'), 'notebook_' || getvariable('notebook_id'), getvariable('current_timestamp') ; insert into _duckdb_ui.notebook_versions (notebook_id, version, title, json, created, expires) select getvariable('notebook_id'), 1, 'imported-notebook-' || getvariable('current_timestamp'), getvariable('notebook_content'), getvariable('current_timestamp'), null ; commit;
Copy code