diff --git a/debugger/test_catalog_magic.ipynb b/debugger/test_catalog_magic.ipynb index 3454e32..72b0b59 100644 --- a/debugger/test_catalog_magic.ipynb +++ b/debugger/test_catalog_magic.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "id": "64fef81a", "metadata": {}, "source": [ "# `%catalog` smoke test on Polaris — immediate execution, no commit\n", @@ -15,10 +16,7 @@ "Everything is written under one scratch folder (`TEST_FOLDER`, below) and removed in\n", "**Cleanup**; the only existing table touched is `SOURCE_TABLE`, and only read.\n", "\n", - "**In the stack's JupyterLab** nothing needs setting up: the pod's environment has every\n", - "setting and your Keycloak token, and `debugger/.env` is not needed.\n", - "\n", - "**Outside JupyterLab (debugging from a laptop)**\n", + "**Before running**\n", "\n", "1. Port-forward RustFS (the catalog's object store) — the command is at the top of\n", " `debugger/.env`.\n", @@ -26,36 +24,53 @@ " and a code; open it in a browser and sign in as **eea-admin**. The notebook then runs as\n", " that user (Polaris, DuckDB, DDS, RustFS), and the token is renewed by itself. Needs\n", " `KEYCLOAK_URL` in `debugger/.env` and the realm's `eea-notebook` client.\n", - "3. Restart the kernel after changing `debugger/.env`: it is read once, in the next cell, and\n", - " never overrides what the kernel environment already has." - ], - "id": "64fef81a" + "3. Restart the kernel after changing `debugger/.env`: it is read once, in the next cell." + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, + "id": "3f7af2e9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sign in to the EEA Lakehouse: open https://172.28.1.6:31443/auth/realms/eea_datalakehouse/device?user_code=EWYT-YSAG (code EWYT-YSAG)\n", + "signed in as eea-admin\n", + "env file /home/oesparza/datahub/EEALakeHouse.python/debugger/.env\n", + "backend polaris\n", + "POLARIS_URI https://172.28.1.6:31443/api/catalog\n", + "catalog (root) eea_lakehouse\n", + "CA file /home/oesparza/datahub/EEALakeHouse.python/debugger/lakehouse-ca.crt\n", + "signed in as eea-admin\n", + "object store http://172.28.1.6:9000\n", + "DDS https://172.28.1.6:31443/dds\n" + ] + } + ], "source": [ "import os\n", "from pathlib import Path\n", "\n", "\n", - "def _find_debugger_env(start: Path | None = None) -> Path | None:\n", - " \"\"\"`debugger/.env`, found by walking up from this notebook (it sits next to\n", - " `debug_run.py`); None when there is none — in the stack's JupyterLab the pod's\n", - " environment already has every setting and secret.\"\"\"\n", + "def _find_debugger_env(start: Path | None = None) -> Path:\n", + " \"\"\"`debugger/.env` — located by walking up from this notebook rather than\n", + " hardcoded, so it works wherever Jupyter's cwd happens to be. Identified by\n", + " sitting next to `debug_run.py`, not just any `.env`.\"\"\"\n", " here = start or Path.cwd()\n", " for candidate in (here, *here.parents):\n", " if (candidate / \"debug_run.py\").exists() and (candidate / \".env\").exists():\n", " return candidate / \".env\"\n", - " return None\n", + " raise RuntimeError(\n", + " f\"could not find debugger/.env from {here} — copy debugger/.env.example to \"\n", + " \"debugger/.env, fill it in, and open this notebook from inside the repository\"\n", + " )\n", "\n", "\n", - "# Outside JupyterLab, debugger/.env supplies the settings; it never overrides what the\n", - "# kernel environment already has (in JupyterLab: the pod's variables and secrets).\n", "ENV_PATH = _find_debugger_env()\n", - "for _line in ENV_PATH.read_text().splitlines() if ENV_PATH else []:\n", + "for _line in ENV_PATH.read_text().splitlines():\n", " _line = _line.strip()\n", " if not _line or _line.startswith(\"#\") or \"=\" not in _line:\n", " continue\n", @@ -70,7 +85,7 @@ " keycloak.login() # prints a link and a code — sign in there as eea-admin\n", "\n", "SETTINGS = PolarisSettings.from_env()\n", - "print(f\"settings from {ENV_PATH or 'the kernel environment only (JupyterLab)'}\")\n", + "print(f\"env file {ENV_PATH}\")\n", "print(f\"backend {backend_name()}\")\n", "print(f\"POLARIS_URI {SETTINGS.uri}\")\n", "print(f\"catalog (root) {SETTINGS.catalog}\")\n", @@ -81,41 +96,69 @@ "assert backend_name() == \"polaris\", \"set EEA_CATALOG_BACKEND=polaris in debugger/.env\"\n", "if SETTINGS.uri.startswith(\"https://\") and not user_token():\n", " print(\"\\n!! nobody signed in: Polaris behind the gateway will refuse every call\")" - ], - "id": "3f7af2e9" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, + "id": "bdfc96fa", "metadata": {}, "outputs": [], "source": [ "import eea_datalakehouse.notebook # registers %catalog/%ingest/%dds/%gpkg/%sdi — no %load_ext needed" - ], - "id": "bdfc96fa" + ] }, { "cell_type": "markdown", + "id": "36010708", "metadata": {}, "source": [ "## Help\n", "\n", "`%catalog help` prints the command table without connecting to anything." - ], - "id": "36010708" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, + "id": "b94a800b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "%catalog methods — usage: %catalog data_copy(\"a.b\", \"c.d\") | %catalog set_tags(\"a.b\", [\"reviewed\"]) (each call runs immediately)\n", + "Backend: Dremio or Polaris, picked by EEA_CATALOG_BACKEND (unset: Polaris when POLARIS_URI is set). On Polaris paths start with the catalog's name (POLARIS_CATALOG, 'eea_lakehouse'), a folder is a namespace, and you are signed in with your Keycloak token (KEYCLOAK_ACCESS_TOKEN; else POLARIS_CLIENT_ID/POLARIS_CLIENT_SECRET).\n", + "A new session's context starts at 'catalog' (the root source), not empty — use(None)/use('') reset back to it too; only set_context(None) clears it to no context at all.\n", + "Every path/source_path/target_path (except use's own) is either absolute or relative to the current context, once one is set:\n", + " - starts with 'catalog.' (this deployment's one real root source; 'eea_lakehouse.' on Polaris) -> always absolute, used exactly as given, never appended to the context\n", + " - '.' or './' alone -> the context itself, exactly as get_context() shows it\n", + " - '../' (or a bare '..'), optionally chained ('../../') -> walks up that many levels of the context first, then appends whatever's left, if anything\n", + " - '.name', or a bare 'name' with no leading '.' at all -> both mean relative to the context; the dot is optional sugar, not what makes it relative\n", + "Only use() ever changes the context — no other call does, even one that fully resolved an absolute path.\n" + ] + }, + { + "data": { + "text/html": [ + "
CommandParametersDescription
usepathSet the current path for every call after this one; path must be a whole, absolute path — never relative to the current context, unlike every other verb's path/source_path/target_path. None or '' resets it to the root ('catalog' on Dremio, 'eea_lakehouse' on Polaris). Raises if path doesn't exist in the catalog. See %%catalog to set it once at the top of a cell.
get_contextShow the current path. A new session starts at the root ('catalog' on Dremio, 'eea_lakehouse' on Polaris); use(None)/use('') reset back to it too — None only after an explicit set_context(None).
data_copysource_path, target_path, overwrite=False, create_target_folder=FalseCopy source_path to target_path. overwrite=False (default) raises CatalogOperationError if target_path already exists; overwrite=True replaces it and is not undoable. A target_path ending in / is a folder, not the table: the folder is created first if it doesn't exist (every missing level), and the table lands inside it under the source's own name — data_copy("draft.t", "archive/2027/") makes archive.2027.t; "./" is the context itself; undo removes the folders it created. create_target_folder=True creates every missing folder level of target_path — except the space/source itself, which must already exist (raises CatalogOperationError otherwise).
data_movesource_path, target_path, overwrite=False, create_target_folder=FalseMove source_path to target_path, always as a TABLE (use create_view for a view). overwrite=False (default) raises CatalogOperationError if target_path already exists; overwrite=True replaces it and is not undoable. A target_path ending in / is a folder, not the table: the folder is created first if it doesn't exist (every missing level), and the table lands inside it under the source's own name — data_copy("draft.t", "archive/2027/") makes archive.2027.t; "./" is the context itself; undo removes the folders it created. create_target_folder=True creates every missing folder level of target_path — except the space/source itself, which must already exist (raises CatalogOperationError otherwise).
create_versionsource_path, version_name, tables=None, target_path=None, overwrite=False, create_target_folder=TrueCopy the listed tables from source_path into a new folder target_path.version_name (as CREATE TABLE snapshots, keeping each table's sub-folders). source_path and version_name must not be blank. tables omitted or empty copies everything under source_path. Each entry is a table or a folder (= every table under it), named as listed under source_path or as list() shows them. target_path omitted means the current context — use() picks where versions go; a missing target_path is created unless create_target_folder=False. Reference/vocabulary tables (a folder named reference(s)/vocabulary(ies) in the path) and views are skipped; the report's notes say which. An existing version folder is an error unless overwrite=True (replaces the listed tables, keeps the rest).
draft_to_versionversion_name, tables=None, overwrite=Falsecreate_version from the dataflow's draft folder, with no paths to type: the source is the draft folder the context is in (or the draft folder inside the context), the target is draft's parent.versions.version_name (versions is created if missing). tables as in create_version: omitted or empty copies everything in draft. Unlike create_version, views in draft are not skipped: each is copied into the version as a table (a snapshot of what it returns); the report's notes say which.
update_latest_releaseversion_name, overwrite=TrueCreate a view at the Area's root for every table in versions.version_name, keeping its sub-folders (versions.v1.a.t gets the view a.t; missing folders are created). The context must be the Area folder — one with draft and versions folders just below it, typically catalog.<domain>.<subdomain>.<area> — and versions.version_name must exist — raises at once otherwise. Views in the version are skipped. An existing view is dropped and recreated over the version (overwrite=True, the default; not undoable) — overwrite=False makes it an error instead; an existing table is always an error. Each view is tagged #public, and #public is removed from every table/view under versions, so only the latest release is public.
publishpath=None, overwrite=True, partition_by=NoneCopy every #public view of a dataflow folder (as update_latest_release leaves them) into public_s3."dh-prod-data-public", as tables at the same full catalog path (catalog.x.y.dataflow.a.t is copied to public_s3."dh-prod-data-public".catalog.x.y.dataflow.a.t). The dataflow folder is path when given (absolute, or relative to the context), else the %catalog use(...) context; with neither it raises. It must have draft, versions and reference (or references) folders just below it — raises at once otherwise. Views and tables in those three folders are ignored; views without the tag are skipped and the report's notes say which. An existing table is replaced (overwrite=True, the default; not undoable) — overwrite=False makes it an error, and then nothing is copied. Each table is checked once copied, and the report's notes give its row count. All or nothing: if any table fails, everything the publish did is rolled back (replaced tables are restored) and an error says which table failed. partition_by (optional) partitions the tables by existing fields, in order: a list for every view (partition_by=["year", "country"]), or a dict for each view's own, keyed by its path below the Area (partition_by={"eu_sdg.monitoringsites": ["year"]}; views left out are not partitioned). A field a view doesn't have raises at once, when publish is called. On Polaris each #public view goes through the Document Service into the public store at <namespace path>/<view>/ (DDS_BASE_URL; you must be a publisher): not all or nothing — an error names the views already published — and partition_by / overwrite=False are not available.
listpath=''Show every table/view under path as a JSON array of {type, name} — type TABLE or VIEW, name the full dot-separated path: its own, then every child folder's, at any depth — walked folder by folder through the catalog's own API (Dremio's or Polaris'), no SQL. path may use '.' or '/' separators. path may be omitted to list the current context itself — raises CatalogSessionError if none is set. Raises CatalogOperationError if path doesn't exist.
schemapathShow path's column schema and row count (never fetches the actual rows). path must be a table or view — raises CatalogOperationError otherwise, or if path doesn't exist at all.
delete_tablepathDelete the table at path. Not undoable. Raises CatalogOperationError if path doesn't exist (unlike a bare DROP TABLE, this doesn't quietly no-op on a typo).
create_viewsource_path, target_path, overwrite=False, create_target_folder=FalseCreate a VIEW at target_path over source_path, leaving source_path untouched. overwrite=False (default) raises CatalogOperationError if target_path already exists; overwrite=True replaces it and is not undoable. create_target_folder=True creates every missing folder level of target_path — except the space/source itself, which must already exist (raises CatalogOperationError otherwise).
delete_viewpathDelete the view at path. Not undoable. Raises CatalogOperationError if path doesn't exist (unlike a bare DROP VIEW, this doesn't quietly no-op on a typo).
set_wikipath, text, tags=NoneSet a path's wiki text. tags: a list of {tag_name, tag_value, tag_title} dicts, e.g. [{"tag_name": "owner", "tag_value": "bw-team", "tag_title": "Owner"}]. Ignored if path is a table/view (they have set_tags/get_tags for that instead).
delete_wikipathDelete a path's wiki text.
get_wikipathShow a path's wiki text. Raises CatalogOperationError if the path doesn't exist, or exists but has no wiki at all.
set_tagspath, tagsReplace a path's tag set. tags: a list of strings, e.g. ["reviewed"]. Tables/views only — raises CatalogOperationError otherwise. On Polaris folders take tags too, and tags are kept lower case without '#' ('#public' and 'public' are the same tag).
delete_tagspath, tagsRemove tags from a path's tag set. tags: a list of strings, e.g. ["reviewed"]. Tables/views only — raises CatalogOperationError otherwise.
get_tagspathShow the tags on a path — tables/views only. Raises CatalogOperationError if the path doesn't exist or isn't a table/view.
create_folderpath, create_parents=FalseCreate a folder. create_parents=True creates every missing level of the full path; create_parents=False (default) raises CatalogOperationError if the parent folder doesn't already exist.
delete_folderpath, cascade=FalseDelete a folder. Not undoable. cascade=True also deletes everything at path and below; cascade=False (default) raises CatalogOperationError if the folder isn't empty. A path that's already gone is not an error.
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "%catalog help" - ], - "id": "b94a800b" + ] }, { "cell_type": "markdown", + "id": "39af68b3", "metadata": {}, "source": [ "## Scratch space\n", @@ -123,14 +166,23 @@ "`TEST_FOLDER` is the one folder this notebook writes to; **Cleanup** deletes it with everything\n", "inside. `SOURCE_TABLE` is an existing table the data cells copy from — only read. `verify` is\n", "an independent client for the checks." - ], - "id": "39af68b3" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, + "id": "c4c97822", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "TEST_FOLDER eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test (exists already!)\n", + "SOURCE_TABLE eea_lakehouse.biodiversity_ecosystems.protected_areas.dfl_natura2000.draft.sites.aaaa exists: True\n" + ] + } + ], "source": [ "from eea_datalakehouse.catalog.polaris import PolarisCatalog\n", "\n", @@ -142,84 +194,140 @@ "verify = PolarisCatalog(SETTINGS) # an independent client: the magic never touches it\n", "print(\"TEST_FOLDER \", TEST_FOLDER, \"(exists already!)\" if verify.exists(TEST_FOLDER) else \"\")\n", "print(\"SOURCE_TABLE \", SOURCE_TABLE, \"exists:\", verify.exists(SOURCE_TABLE))" - ], - "id": "c4c97822" + ] }, { "cell_type": "markdown", + "id": "6d53a1cd", "metadata": {}, "source": [ "## 1. A call runs immediately\n", "\n", "`create_folder` is the only `%catalog` call in the cell — no `%catalog commit` after it. On\n", "Polaris a folder is a namespace." - ], - "id": "6d53a1cd" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, + "id": "45d8ff5e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "CommitReport(succeeded=[\"create folder 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test'\"], notes=[])" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog create_folder(TEST_FOLDER, create_parents=True)" - ], - "id": "45d8ff5e" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, + "id": "d90b81ed", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "folder exists right now: True | is a namespace: True\n" + ] + } + ], "source": [ "print(\"folder exists right now:\", verify.exists(TEST_FOLDER), \"| is a namespace:\", verify.is_folder(TEST_FOLDER))" - ], - "id": "d90b81ed" + ] }, { "cell_type": "markdown", + "id": "d450519d", "metadata": {}, "source": [ "## 2. Context and relative paths\n", "\n", "`use` sets the context; a bare name (or `.name`) is then relative to it. Absolute paths start\n", "with the catalog's name (`eea_lakehouse.`) — on Dremio they started with `catalog.`." - ], - "id": "d450519d" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, + "id": "3721db27", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "context set to 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test'\n" + ] + }, + { + "data": { + "text/plain": [ + "'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test'" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog use(TEST_FOLDER)\n", "%catalog get_context()" - ], - "id": "3721db27" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, + "id": "bedfc770", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "CommitReport(succeeded=[\"create folder 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.nested'\"], notes=[])" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog create_folder(\"nested\") # -> TEST_FOLDER + \".nested\"" - ], - "id": "bedfc770" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, + "id": "3bd26c7e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "nested folder exists right now: True\n" + ] + } + ], "source": [ "print(\"nested folder exists right now:\", verify.exists(f\"{TEST_FOLDER}.nested\"))" - ], - "id": "3bd26c7e" + ] }, { "cell_type": "markdown", + "id": "40f2527a", "metadata": {}, "source": [ "## 3. Wiki and tags — also immediate\n", @@ -227,63 +335,109 @@ "On Polaris the wiki is the namespace's (or table's) `wiki` property, and tags are kept as the\n", "Polaris Navigator keeps them: lower case, without `#` (`#Smoke` and `smoke` are the same tag).\n", "Folders take tags too. `tags=` on a folder's wiki renders a \"# Meta Data\" block, as on Dremio." - ], - "id": "40f2527a" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, + "id": "29ac62a2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "CommitReport(succeeded=[\"set wiki on 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test'\"], notes=[])" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog set_wiki(\".\", \"# Catalog magic smoke test\\n\\nCreated by the %catalog debugger notebook.\", tags=[{\"tag_name\": \"owner\", \"tag_value\": \"debugger\", \"tag_title\": \"Owner\"}])" - ], - "id": "29ac62a2" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, + "id": "f76508c9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "# Catalog magic smoke test\n", + "\n", + "Created by the %catalog debugger notebook.\n", + "\n", + "# Meta Data\n", + "\tOwner : debugger\n", + "\n", + "\n", + "\n" + ] + } + ], "source": [ "print(verify.getwikifrom(TEST_FOLDER, idempotency_key=\"smoke-read-wiki\"))" - ], - "id": "f76508c9" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, + "id": "2a3d9a5b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['smoke', 'test']" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog set_tags(\".\", [\"#Smoke\", \"test\"])\n", "%catalog get_tags(\".\")" - ], - "id": "2a3d9a5b" + ] }, { "cell_type": "markdown", + "id": "8b2cdc00", "metadata": {}, "source": [ "## 4. What a failed call looks like\n", "\n", "`TEST_FOLDER` holds `nested`, so deleting it without `cascade=True` fails — `%catalog` prints a\n", "short message instead of a traceback." - ], - "id": "8b2cdc00" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, + "id": "5ca5d62e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "catalog error: commit failed at step 1/1 (delete folder 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test'): 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test' is not empty — pass cascade=True to delete everything in it. Everything before it was rolled back.\n" + ] + } + ], "source": [ "%catalog delete_folder(TEST_FOLDER) # cascade=False (the default) — expected to fail, folder not empty" - ], - "id": "5ca5d62e" + ] }, { "cell_type": "markdown", + "id": "6e4f220e", "metadata": {}, "source": [ "## 5. Data: copy, schema, views, move\n", @@ -291,74 +445,143 @@ "`data_copy` runs `CREATE TABLE … AS SELECT` in this kernel's DuckDB, writing an Iceberg table\n", "through Polaris (columns Iceberg can't hold are cast: nanosecond timestamps, geometry, …).\n", "`schema` of a table comes from its Iceberg metadata; of a view, from running its SQL." - ], - "id": "6e4f220e" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, + "id": "a4e6d60b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "CommitReport(succeeded=[\"data_copy 'eea_lakehouse.biodiversity_ecosystems.protected_areas.dfl_natura2000.draft.sites.aaaa' -> 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.nested.copy'\"], notes=[])" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog data_copy(SOURCE_TABLE, \"nested.copy\")" - ], - "id": "a4e6d60b" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, + "id": "f3a7c4aa", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "TableInfo(schema={'id': 'long', 'station': 'string', 'measured_at': 'timestamptz', 'value': 'double', 'is_valid': 'boolean', 'reported_on': 'date'}, row_count=10)" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog schema(\"nested.copy\")" - ], - "id": "f3a7c4aa" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, + "id": "faec2ef2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "copy is a: TABLE\n" + ] + } + ], "source": [ "print(\"copy is a:\", verify.entry_kind(f\"{TEST_FOLDER}.nested.copy\", idempotency_key=\"smoke\"))" - ], - "id": "faec2ef2" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, + "id": "d7b20734", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "TableInfo(schema={'id': 'long', 'station': 'string', 'measured_at': 'timestamptz', 'value': 'double', 'is_valid': 'boolean', 'reported_on': 'date'}, row_count=10)" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog create_view(\"nested.copy\", \"nested.copy_view\")\n", "%catalog schema(\"nested.copy_view\")" - ], - "id": "d7b20734" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, + "id": "27b35c16", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "SELECT * FROM \"eea_lakehouse\".\"non_domain_datasets.catalog_magic_smoke_test.nested\".\"copy\"\n" + ] + } + ], "source": [ "print(verify.view_sql(f\"{TEST_FOLDER}.nested.copy_view\"))" - ], - "id": "27b35c16" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, + "id": "4509ca89", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[\n", + " {\n", + " \"type\": \"TABLE\",\n", + " \"name\": \"eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.moved.copy\"\n", + " },\n", + " {\n", + " \"type\": \"VIEW\",\n", + " \"name\": \"eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.nested.copy_view\"\n", + " }\n", + "]" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog data_copy(SOURCE_TABLE, \"nested.copy\", overwrite=True) # replaces the table\n", "%catalog data_move(\"nested.copy\", \"moved/\") # a target ending in / is a folder, created\n", "%catalog list()" - ], - "id": "4509ca89" + ] }, { "cell_type": "markdown", + "id": "5785c55a", "metadata": {}, "source": [ "## 6. A dataflow release: draft → version → latest views\n", @@ -366,14 +589,22 @@ "An Area folder holds `draft`, `versions` and `reference`. `draft_to_version` copies the draft\n", "into `versions.` (views as tables); `update_latest_release` puts a view at the Area's\n", "root over every table of that version and tags it `public`." - ], - "id": "5785c55a" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, + "id": "73a7e215", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "context set to 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke'\n" + ] + } + ], "source": [ "AREA = f\"{TEST_FOLDER}.dfl_smoke\"\n", "%catalog create_folder(f\"{AREA}.draft\", create_parents=True)\n", @@ -381,61 +612,126 @@ "%catalog create_folder(f\"{AREA}.reference\")\n", "%catalog data_copy(SOURCE_TABLE, f\"{AREA}.draft.stations\")\n", "%catalog use(AREA)" - ], - "id": "73a7e215" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, + "id": "fb1e2aec", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "CommitReport(succeeded=[\"create version 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.versions.v2026_1' from 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft' (all tables)\"], notes=[])" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog draft_to_version(\"v2026_1\")" - ], - "id": "fb1e2aec" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, + "id": "3d8855a5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "CommitReport(succeeded=[\"create views under 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke' for the tables in 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.versions.v2026_1'\"], notes=[])" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog update_latest_release(\"v2026_1\")" - ], - "id": "3d8855a5" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, + "id": "65299b51", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[\n", + " {\n", + " \"type\": \"TABLE\",\n", + " \"name\": \"eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.stations\"\n", + " },\n", + " {\n", + " \"type\": \"VIEW\",\n", + " \"name\": \"eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.stations\"\n", + " },\n", + " {\n", + " \"type\": \"TABLE\",\n", + " \"name\": \"eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.versions.v2026_1.stations\"\n", + " }\n", + "]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog list()" - ], - "id": "65299b51" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, + "id": "076f21a5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['public']" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog get_tags(\"stations\")" - ], - "id": "076f21a5" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, + "id": "32c56703", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "latest view reads the version: SELECT * FROM \"eea_lakehouse\".\"non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.versions.v2026_1\".\"stations\"\n" + ] + } + ], "source": [ "print(\"latest view reads the version:\", verify.view_sql(f\"{AREA}.stations\"))" - ], - "id": "32c56703" + ] }, { "cell_type": "markdown", + "id": "81655c19", "metadata": {}, "source": [ "### Publishing (writes to the real public store — off by default)\n", @@ -443,21 +739,21 @@ "`publish` pushes every `public` view of the Area through the Document Service to the public\n", "store, at `//`. It needs a Keycloak token of a member of the publishers'\n", "group, and DDS. Uncomment to run — and unpublish afterwards." - ], - "id": "81655c19" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 62, + "id": "fd47c58f", "metadata": {}, "outputs": [], "source": [ "# %catalog publish()" - ], - "id": "fd47c58f" + ] }, { "cell_type": "markdown", + "id": "21202009", "metadata": {}, "source": [ "## 7. `%ingest`: upload to the object store, then a table\n", @@ -466,14 +762,22 @@ "Iceberg table (Parquet, CSV or JSON) and removes the staged files; `\"parquet\"` keeps Parquet\n", "files as they are, registered as a read-only table (`sub_path` adds a sub-folder each time), and\n", "`promote` turns that into Iceberg later. Small local files are generated first." - ], - "id": "21202009" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, + "id": "dba0484a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/tmp/catalog_magic_smoke_jpk0iz9v\n" + ] + } + ], "source": [ "import tempfile\n", "\n", @@ -491,78 +795,162 @@ "(INGEST_DIR / \"samples\" / \"samples.csv\").write_text(\"id;value\\n1;3.5\\n2;4.0\\n3;4.5\\n\")\n", "TEMPS, SAMPLES = str(INGEST_DIR / \"temps\"), str(INGEST_DIR / \"samples\")\n", "print(INGEST_DIR)" - ], - "id": "dba0484a" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, + "id": "b42ca6d2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ingest '/tmp/catalog_magic_smoke_jpk0iz9v/temps' -> 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft' (Polaris):\n", + "✓ sign-in: Keycloak user 'eea-admin'\n", + "✓ files: 1 parquet file(s), 1002 bytes\n", + "✓ target: eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.temps (new)\n", + "✓ storage: s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/draft/_ingestion/eea_admin-20261201T091904Z-9e22cb/temps/ reachable (sts keys)\n", + "ingest '/tmp/catalog_magic_smoke_jpk0iz9v/samples' -> 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft' (Polaris):\n", + "✓ sign-in: Keycloak user 'eea-admin'\n", + "✓ files: 1 csv file(s), 27 bytes\n", + "✓ target: eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.samples (new)\n", + "✓ storage: s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/draft/_ingestion/eea_admin-20261201T091904Z-5f48fb/samples/ reachable (sts keys)\n", + "ingest '/tmp/catalog_magic_smoke_jpk0iz9v/temps' -> 'eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.reference' (Polaris):\n", + "✓ sign-in: Keycloak user 'eea-admin'\n", + "✓ files: 1 parquet file(s), 1002 bytes\n", + "✓ target: eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.reference.temps_ro (new)\n", + "✓ storage: s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/reference/temps_ro/ reachable (sts keys)\n" + ] + } + ], "source": [ "%ingest ingest(folder=TEMPS, target_catalog_path=f\"{AREA}.draft\", data_format=\"parquet\", table_name=\"temps\")\n", "%ingest ingest(folder=SAMPLES, target_catalog_path=f\"{AREA}.draft\", data_format=\"csv\", csv_options={\"delimiter\": \";\"})\n", "%ingest ingest(folder=TEMPS, target_catalog_path=f\"{AREA}.reference\", data_format=\"parquet\", table_format=\"parquet\", table_name=\"temps_ro\", sub_path=\"2026\")\n", "%ingest diagnose" - ], - "id": "b42ca6d2" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, + "id": "f8b18f98", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "uploading 1 file(s) to s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/draft/_ingestion/eea_admin-20261201T091909Z-d1eec3/temps/\n", + " uploaded 1/1: part-1.parquet\n", + "loading into eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.temps\n", + "uploading 1 file(s) to s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/draft/_ingestion/eea_admin-20261201T091910Z-09e10f/samples/\n", + " uploaded 1/1: samples.csv\n", + "loading into eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.samples\n", + "uploading 1 file(s) to s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/reference/temps_ro/2026/\n", + " uploaded 1/1: part-1.parquet\n", + "created iceberg table eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.temps (2 rows, 1 files)\n", + "created iceberg table eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.samples (3 rows, 1 files)\n", + "created parquet table eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.reference.temps_ro (2 rows, 1 files) at s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/reference/temps_ro/\n" + ] + } + ], "source": [ "report = %ingest commit\n", "for outcome in report.outcomes:\n", " print(outcome)\n", " for note in outcome.notes:\n", " print(\" note:\", note)" - ], - "id": "f8b18f98" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, + "id": "2d3e7b30", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "TableInfo(schema={'site': 'string', 'temp': 'double', 'at': 'timestamp'}, row_count=2)" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog schema(\"draft.temps\")" - ], - "id": "2d3e7b30" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, + "id": "2858c4fc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "TableInfo(schema={'site': 'VARCHAR', 'temp': 'DOUBLE', 'at': 'TIMESTAMP_NS'}, row_count=2)" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog schema(\"reference.temps_ro\")" - ], - "id": "2858c4fc" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, + "id": "7ca12f16", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "PolarisIngestOutcome(table='eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.reference.temps_ro', table_format='iceberg', action='promoted', rows=2, files=1, location=None, notes=[])" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%ingest promote(f\"{AREA}.reference.temps_ro\")" - ], - "id": "7ca12f16" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, + "id": "be93abcd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "TableInfo(schema={'site': 'string', 'temp': 'double', 'at': 'timestamp'}, row_count=2)" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%catalog schema(\"reference.temps_ro\")" - ], - "id": "be93abcd" + ] }, { "cell_type": "markdown", + "id": "134d95ff", "metadata": {}, "source": [ "## 8. `%dds` — the context's document folders\n", @@ -570,33 +958,56 @@ "On Polaris `%dds` signs in with your Keycloak token (the eea-admin sign-in above) and stores\n", "under the namespace's path without the catalog name\n", "(`…non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/…`)." - ], - "id": "134d95ff" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, + "id": "299b0378", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/deliverables'" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "(INGEST_DIR / \"readme.txt\").write_text(\"catalog magic smoke test\")\n", "%dds target(DELIVERABLES)" - ], - "id": "299b0378" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, + "id": "959cbdc3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "1 file(s) in non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/deliverables:\n", + " readme.txt" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%dds push(DELIVERABLES, str(INGEST_DIR / \"readme.txt\"), overwrite=True)\n", "%dds list(DELIVERABLES)" - ], - "id": "959cbdc3" + ] }, { "cell_type": "markdown", + "id": "511131a3", "metadata": {}, "source": [ "## 9. `%gpkg` — GeoPackage export\n", @@ -605,53 +1016,109 @@ "`FLIGHT_HOST` names one (as you: your Keycloak token). With `FLIGHT_HOST` empty — the\n", "172.28.1.6 cluster has no Flight gateway — it reads them through this kernel's own DuckDB,\n", "signed in as `%catalog` is. Spatial tables become feature layers, the rest attribute tables." - ], - "id": "511131a3" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, + "id": "63146098", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "exporting 6 table(s)/view(s) from eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke to /tmp/catalog_magic_smoke_jpk0iz9v/catalog_magic_smoke.gpkg, 4 at a time\n", + "✓ 1/6 temps_ro ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.reference.temps_ro: attributes, 2 rows, 0.3s\n", + "✓ 2/6 temps ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.temps: attributes, 2 rows, 0.3s\n", + "✓ 3/6 draft_stations ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.stations: attributes, 10 rows, 0.8s\n", + "✓ 4/6 samples ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.samples: attributes, 3 rows, 0.9s\n", + "✓ 5/6 versions_v2026_1_stations ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.versions.v2026_1.stations: attributes, 10 rows, 0.6s\n", + "✓ 6/6 stations ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.stations: attributes, 10 rows, 0.6s\n", + "done: /tmp/catalog_magic_smoke_jpk0iz9v/catalog_magic_smoke.gpkg — 6 layer(s), 37 rows in 0.9s\n" + ] + }, + { + "data": { + "text/plain": [ + "wrote /tmp/catalog_magic_smoke_jpk0iz9v/catalog_magic_smoke.gpkg — 6 layer(s):\n", + " samples ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.samples [attributes (no geometry); 3 rows]\n", + " draft_stations ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.stations [attributes (no geometry); 10 rows]\n", + " temps ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.draft.temps [attributes (no geometry); 2 rows]\n", + " temps_ro ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.reference.temps_ro [attributes (no geometry); 2 rows]\n", + " stations ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.stations [attributes (no geometry); 10 rows]\n", + " versions_v2026_1_stations ← eea_lakehouse.non_domain_datasets.catalog_magic_smoke_test.dfl_smoke.versions.v2026_1.stations [attributes (no geometry); 10 rows]" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "gpkg = %gpkg export(limit=100, filename=\"catalog_magic_smoke.gpkg\", output_dir=str(INGEST_DIR))\n", "gpkg" - ], - "id": "63146098" + ] }, { "cell_type": "markdown", + "id": "a64d12fb", "metadata": {}, "source": [ "### Upload the GeoPackage to DDS\n", "\n", "The export's report is the file: `%dds push` takes it as it is and stores it under the\n", "context's `deliverables` folder, replacing an earlier upload of the same name." - ], - "id": "a64d12fb" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, + "id": "7c9af9f6", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "pushed 1 file(s) to non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/deliverables:\n", + " non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/deliverables/catalog_magic_smoke.gpkg" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%dds push(DELIVERABLES, gpkg, overwrite=True)" - ], - "id": "7c9af9f6" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 72, + "id": "14fc8734", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "2 file(s) in non_domain_datasets/catalog_magic_smoke_test/dfl_smoke/deliverables:\n", + " catalog_magic_smoke.gpkg\n", + " readme.txt" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%dds list(DELIVERABLES)" - ], - "id": "14fc8734" + ] }, { "cell_type": "markdown", + "id": "b6d9f8dd", "metadata": {}, "source": [ "## Cleanup\n", @@ -660,27 +1127,69 @@ "A principal Polaris doesn't let purge files (e.g. the root client) drops tables from the catalog\n", "only; the cell after it removes whatever data files are left in the scratch folder's own\n", "storage location — nothing else." - ], - "id": "b6d9f8dd" + ] + }, + { + "cell_type": "markdown", + "id": "2db4891d", + "metadata": {}, + "source": [] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, + "id": "5484c544", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "context set to 'eea_lakehouse'\n", + "folder exists after cleanup: False\n" + ] + } + ], "source": [ "SCRATCH_LOCATION = verify.rest.namespace_properties(verify.parts(TEST_FOLDER)).get(\"location\")\n", "%catalog use(None)\n", "%catalog delete_folder(TEST_FOLDER, cascade=True)\n", "print(\"folder exists after cleanup:\", verify.exists(TEST_FOLDER))" - ], - "id": "5484c544" + ] }, { "cell_type": "code", "execution_count": null, + "id": "ce67120b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "PolarisSettings(uri='https://172.28.1.6:31443/api/catalog', catalog='eea_lakehouse', client_id='root', client_secret='c4059968fcf7d35986bde938b8825ff08b1e2cc3010f84c2f7179f1e79d409d1', vended_credentials=False, s3_endpoint='http://localhost:19000', s3_region='us-east-1', s3_access_key='rustfsadmin', s3_secret_key='8aaee44a1efe51eeefd74903aceb8a63ab0b317211e622bbc7bd1435e2eada9a', ingest_bucket='', ingest_prefix='_ingestion', role_arn='arn:aws:iam:::role/eea-datalakehouse', flight_host='', flight_port=8815, dds_base_url='https://172.28.1.6:31443/dds', ca_file='/home/oesparza/datahub/EEALakeHouse.python/debugger/lakehouse-ca.crt')" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "69cde9e9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "removed 32 leftover file(s) under s3://lakehouse/catalog/non_domain_datasets/catalog_magic_smoke_test/\n" + ] + } + ], "source": [ "from eea_datalakehouse.catalog.object_store import ObjectStore, s3_credentials\n", "\n", @@ -690,13 +1199,12 @@ " store.delete(left)\n", " print(f\"removed {len(left)} leftover file(s) under {SCRATCH_LOCATION}\")\n", "verify.close()" - ], - "id": "69cde9e9" + ] } ], "metadata": { "kernelspec": { - "display_name": ".venv (3.12.3)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -710,7 +1218,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.14.10" } }, "nbformat": 4,