Front-end cartographer. Research Engineer in Geographic Information Science at CNRS & UAR RIATE. Author of Mad Maps (2019), Practical Handbook of Thematic Cartography (2016, 2020, 2025) and Cartographia (2025).
Great notebook and thanks for sharing! You’ll want to combine the declaration of the DuckDB instance and the tables in the same cell, for example:
```
const geoDb = await DuckDBClient.of({world});
await geoDb.query(`INSTALL spatial; LOAD spatial;`);
await geoDb.query(`CREATE OR REPLACE TABLE world AS SELECT …`);
```
If you instead define the table in a different cell (as above), there’s a good chance that cells that query the database (geoDb) could see it before the `world` table has been created. In other words, those queries mutate the database, and on Observable you don’t want to mutate a value defined in another cell because it causes unpredictable behavior. Whereas if you do the mutation within the cell that defines the value, it’s safe because downstream cells will wait for the mutation to be applied before running. Hope this helps.