Cameron Smith commited on
Commit
8781e4e
·
unverified ·
1 Parent(s): f8ed6c1

feat: add space dataset query script

Browse files
Files changed (1) hide show
  1. queries/space.sql +42 -0
queries/space.sql ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- DuckDB script to explore the space fixtures ducklake dataset
2
+ -- Usage: duckdb -box < explore_space.sql
3
+ -- or: duckdb < explore_space.sql
4
+ -- or: duckdb -c ".read explore_space.sql"
5
+
6
+ -- Install and load required extensions
7
+ INSTALL httpfs;
8
+ INSTALL ducklake;
9
+ LOAD httpfs;
10
+ LOAD ducklake;
11
+
12
+ -- Verify extensions are loaded
13
+ SELECT extension_name, loaded, extension_version
14
+ FROM duckdb_extensions()
15
+ WHERE extension_name IN ('httpfs', 'ducklake') AND loaded;
16
+
17
+ -- Attach ducklake metadata database from HuggingFace
18
+ -- Requires: hf auth login --token "${HF_TOKEN}" --add-to-git-credential
19
+ ATTACH 'ducklake:hf://datasets/sciexp/fixtures/lakes/frozen/space.db' AS space;
20
+
21
+ -- Alternative: attach from local clone (uncomment to use)
22
+ -- ATTACH 'ducklake:lakes/frozen/space.db' AS space;
23
+
24
+ USE space;
25
+
26
+ -- ducklake metadata is available in `__ducklake_metadata_*` db `ducklake_*` tables
27
+ -- SHOW ALL TABLES;
28
+
29
+ -- Show available tables in the space schema
30
+ SHOW TABLES FROM space.main;
31
+
32
+ -- Describe astronauts table schema
33
+ DESCRIBE space.main.astronauts;
34
+
35
+ -- Statistical summary of astronauts table
36
+ SUMMARIZE space.main.astronauts;
37
+
38
+ -- Find the most experienced astronauts by total space days
39
+ SELECT name, nationality, total_space_days, total_flights
40
+ FROM astronauts
41
+ ORDER BY total_space_days DESC
42
+ LIMIT 10;