Public
Edited
Dec 24, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
db = DuckDBClient.of([FileAttachment('iris.json'), FileAttachment('penguins.csv'), FileAttachment('weather.parquet')])
Insert cell
Insert cell
db
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
db
SHOW TABLES
Insert cell
db.describe()
Insert cell
Insert cell
Insert cell
Insert cell
db.describe(`${table}`)
Insert cell
Insert cell
Insert cell
viewof tableSummary = SummaryTable(data, {label: table})
Insert cell
Insert cell
Insert cell
Inputs.table(searchResults)
Insert cell
data = db.sql([`SELECT * FROM ${table}`])
Insert cell
Insert cell
viewof jsQueryEditor = Wrangler(data)
Insert cell
Insert cell
db
SELECT * FROM penguins
Insert cell
Insert cell
Insert cell
tablesDiagram = diagram(db)
Insert cell
Insert cell
Insert cell
mermaidTablesDiagram = mermaidDiagram(db)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
schemas = (await db.query('select * from information_schema.schemata')).toArray().map(Object.fromEntries)
Insert cell
Insert cell
Insert cell
dataTables = (await db.query('select * from information_schema.tables')).toArray().map(Object.fromEntries)
Insert cell
Insert cell
Insert cell
allTableColumns = (await db.query('select * from information_schema.columns')).toArray().map(Object.fromEntries)
Insert cell
Insert cell
Insert cell
Insert cell
databaseList = (await db.query('PRAGMA database_list')).toArray().map(Object.fromEntries)
Insert cell
Insert cell
Insert cell
tableList = (await db.query('PRAGMA show_tables')).toArray().map(Object.fromEntries)
Insert cell
Insert cell
viewof selectedTable = Inputs.select(tableList.map(table => table.name), {label: md`#### Table`})
Insert cell
Insert cell
tableInfo = (await db.query(`PRAGMA table_info('${selectedTable}')`)).toArray().map(Object.fromEntries)
Insert cell
Insert cell
Insert cell
showTable = (await db.query(`PRAGMA show('${selectedTable}')`)).toArray().map(Object.fromEntries)
Insert cell
Insert cell
Insert cell
databaseSize = (await db.query('PRAGMA database_size')).toArray().map(Object.fromEntries)
Insert cell
Insert cell
Insert cell
databaseConfig = (await db.query('SELECT * FROM duckdb_settings()')).toArray().map(Object.fromEntries)
Insert cell
Insert cell
libraryVersion
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more