Published
Edited
Aug 26, 2022
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
db = DemoSQLitePathDatabaseClient(FileAttachment("react-archive.db").blob())
Insert cell
db
select path_version(), path_debug();
Insert cell
Insert cell
db
select * from pragma_function_list where name like 'path%' order by 1;
Insert cell
Insert cell
db
select * from react_files limit 20;
Insert cell
Insert cell
db
select
path_at(name, 1) top_directory,
sum(size) sum_bytes
from react_files
-- filter out top-level files
where (select count(*) from path_parts(name)) > 2
group by 1
order by 2 desc;
Insert cell
Insert cell
db
select name, size
from react_files
where path_at(name, 1) = 'packages'
order by 2 desc;
Insert cell
Insert cell
db
select
name,
size
from react_files
where path_extension(name) not in ('.js', '.lock', '.json')
order by 2 desc;
Insert cell
Insert cell
db
select name
from react_files;
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sqljs = require(await FileAttachment("path0-sqljs.js").url())
Insert cell
wasm = FileAttachment("path0-sqljs.wasm").url()
Insert cell
DemoSQLitePathDatabaseClient = async (source) => {
//Adapted from https://github.com/observablehq/stdlib/blob/main/src/sqlite.js
function load(source) {
return typeof source === "string"
? fetch(source).then(load)
: source instanceof Response || source instanceof Blob
? source.arrayBuffer().then(load)
: source instanceof ArrayBuffer
? new Uint8Array(source)
: source;
}

const [SQL, buffer] = await Promise.all([
sqljs({ locateFile: (filename, prefix) => wasm }),
Promise.resolve(source).then(load)
]);

return new SQLiteDatabaseClient(new SQL.Database(buffer));
}
Insert cell
pics = Promise.all([
FileAttachment(
"DALL·E 2022-08-25 19.04.40 - wooden bridge over a river, animation, playful.png"
).url(),
FileAttachment(
"DALL·E 2022-08-25 19.04.52 - Incredible, wooden bridge over a river, matte painting, dramatic lighting.png"
).url(),
FileAttachment(
"DALL·E 2022-08-25 19.05.00 - wooden bridge over a river, animation, playful.png"
).url()
])
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