Public
Edited
Mar 8, 2023
Insert cell
Insert cell
Insert cell
Insert cell
gaiadb = DuckDBClient.of({
gaia: FileAttachment("gaia-sample.arrow")
})
Insert cell
Insert cell
Insert cell
gaiadb
SELECT * FROM gaia USING SAMPLE 10%
Insert cell
Insert cell
stars // the results of the SQL query above
Insert cell
stars[0] // the first row
Insert cell
stars[0].ra // the ra (right ascension) field of the first row
Insert cell
Insert cell
stocks = DuckDBClient.of({
aapl: FileAttachment("aapl.csv"),
amzn: FileAttachment("amzn.csv"),
goog: FileAttachment("goog.csv"),
ibm: FileAttachment("ibm.csv")
})
Insert cell
stocks
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
moviesdb = DuckDBClient.of({
movies: {
file: FileAttachment("movies.csv"),
dateFormat: "%b %d %Y" // e.g. Jun 12 1998
}
})
Insert cell
Insert cell
limiteddb
SELECT IMDB_Rating, Rotten_Tomatoes_Rating FROM movies
ORDER BY IMDB_Rating
Insert cell
limiteddb
SELECT FLOOR((IMDB_Rating - 2) / 2) AS key,
-- FROM movies
count(*) AS binCount FROM movies
WHERE IMDB_Rating BETWEEN 2 AND 10
GROUP BY key
Insert cell
Insert cell
Insert cell
stocks.sql`SELECT Open, Close, Volume FROM aapl WHERE Volume > ${100_000_000}`
Insert cell
stocks.query("SELECT Open, Close, Volume FROM aapl WHERE Volume > ?", [100_000_000])
Insert cell
Insert cell
maxaapl = stocks.queryRow("SELECT Date, Open, Close, Volume FROM aapl ORDER BY Volume DESC LIMIT 1")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more