diff --git a/dev/notebooks/motherduck.ipynb b/dev/notebooks/motherduck.ipynb index ab510bdf..787632d4 100644 --- a/dev/notebooks/motherduck.ipynb +++ b/dev/notebooks/motherduck.ipynb @@ -5,7 +5,7 @@ "id": "1e618c1e-a6c4-41c7-a771-98a0fc2f68c8", "metadata": {}, "source": [ - "This notebook shows that Mosaic works with a serverless DuckDB using [MotherDuck](https://motherduck.com). To use this notebook, you need to have access to MotherDuck and the [Gaia dataset](http://cdn.gea.esac.esa.int/Gaia/gdr3/gaia_source/) in a specific database. We will make this notebook more general in the future." + "This notebook shows that Mosaic works with a serverless DuckDB using [MotherDuck](https://motherduck.com). We are using the [Gaia dataset](http://cdn.gea.esac.esa.int/Gaia/gdr3/gaia_source/) from a [share](https://motherduck.com/docs/key-tasks/querying-a-shared-motherduck-database)." ] }, { @@ -31,7 +31,10 @@ }, "outputs": [], "source": [ - "con = duckdb.connect(\"md:gaia-import\")\n", + "con = duckdb.connect()\n", + "\n", + "share = 'md:_share/gaia-import/c551f2da-3258-4387-ac43-f4be601850ac'\n", + "con.execute(f\"ATTACH '{share}' AS share\")\n", "\n", "con.execute(\"ATTACH ':memory:' AS local\")\n", "# con.execute(\"ATTACH 'indexes.db' AS local\") # use a local database for the indexes" @@ -51,7 +54,7 @@ "del spec[\"data\"]\n", "\n", "# we use a sample (code to create it below)\n", - "table = \"gaia-import.gaia_sample_5_percent_projected\"\n", + "table = \"share.gaia_sample_5_percent_projected\"\n", "\n", "spec[\"hconcat\"][0][\"vconcat\"][0][\"plot\"][0][\"data\"][\"from\"] = table\n", "spec[\"hconcat\"][0][\"vconcat\"][1][\"hconcat\"][0][\"plot\"][0][\"data\"][\"from\"] = table\n", @@ -103,6 +106,21 @@ "c.query(\"FORCE INSTALL motherduck\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "b4c77342-c19c-4e83-9068-2e4b80191612", + "metadata": {}, + "outputs": [], + "source": [ + "# Show all tables in the share\n", + "\n", + "c = duckdb.connect()\n", + "c.execute(f\"ATTACH '{share}' AS share\")\n", + "c.execute(\"USE share\")\n", + "c.query(\"SHOW TABLES\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -112,7 +130,8 @@ }, "outputs": [], "source": [ - "# Create a table with the u and v columns with natural earth projection\n", + "# Create a table with the u and v columns with natural earth projection.\n", + "# This will not work in the share and assumes a specific setup.\n", "\n", "c = duckdb.connect(\"md:gaia-import\")\n", "\n", @@ -143,19 +162,6 @@ "\"\"\")" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "b4c77342-c19c-4e83-9068-2e4b80191612", - "metadata": {}, - "outputs": [], - "source": [ - "# Show all remote tables\n", - "\n", - "c = duckdb.connect(\"md:gaia-import\")\n", - "c.query(\"SHOW TABLES\")" - ] - }, { "cell_type": "code", "execution_count": null,