User helpers
Helpers that authenticate as you: in a JupyterHub notebook, on a laptop, or in any
other code you run yourself. databaas_utils.notebook is the module's former name and
still works as an alias.
databaas_utils.user
One-line entry points that authenticate as the person running the code.
Mirrors databaas_utils.airflow's helpers, but the identity is the user,
not a pipeline's service account:
- inside a JupyterHub singleuser pod, the token the hub mints for the
logged-in user (
LakehouseSettings.from_jupyterhub); - anywhere else (a laptop notebook, a script, a local app), the session saved
by
databaas login(LakehouseSettings.from_profile).
So the same code runs unchanged on the platform and on a laptop. DAGs must not use this module: a task authenticates through its Airflow connection.
get_settings
get_settings(
*,
namespace: str | None = None,
warehouse: str | None = None,
profile: str | None = None,
) -> LakehouseSettings
Settings for the current user.
An explicit profile always means the databaas login session, even
inside JupyterHub.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str | None
|
Default namespace for tables and generic tables. |
None
|
warehouse
|
str | None
|
Overrides the warehouse. |
None
|
profile
|
str | None
|
A |
None
|
Raises:
| Type | Description |
|---|---|
ConfigurationError
|
Outside JupyterHub, if no |
AuthenticationError
|
If a token cannot be obtained. |
Example
settings = get_settings(namespace="knmi")
get_catalog
get_catalog(
*,
warehouse: str | None = None,
profile: str | None = None,
**overrides: str,
) -> Catalog
A pyiceberg REST catalog, signing through Lakekeeper.
Use fully qualified namespace.table identifiers with it. Needs the
iceberg extra.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warehouse
|
str | None
|
Overrides the warehouse. |
None
|
profile
|
str | None
|
A |
None
|
**overrides
|
str
|
pyiceberg catalog properties that replace the defaults. |
{}
|
Example
catalog = get_catalog() catalog.load_table("open_meteo.daily_summary").scan(limit=10).to_arrow()
get_store
get_store(
*,
namespace: str | None = None,
warehouse: str | None = None,
profile: str | None = None,
) -> GenericTableStore
Files under generic tables in namespace, on remote-signed storage.
Needs the obstore extra.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str | None
|
Namespace holding the generic tables. |
None
|
warehouse
|
str | None
|
Overrides the warehouse. |
None
|
profile
|
str | None
|
A |
None
|
Example
store = get_store(namespace="knmi") store.get("harmonie", "2026/09/30/run.grib2", Path("run.grib2"))
get_index
get_index(
*,
namespace: str | None = None,
table: str = "files",
warehouse: str | None = None,
profile: str | None = None,
) -> FileIndex
The Iceberg index of what landed in namespace's generic tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str | None
|
Namespace holding the index table. |
None
|
table
|
str
|
Index table name. |
'files'
|
warehouse
|
str | None
|
Overrides the warehouse. |
None
|
profile
|
str | None
|
A |
None
|
Example
get_index(namespace="knmi").scan(limit=10)
get_zarr_group
get_zarr_group(
table: str,
*,
namespace: str | None = None,
path: str = "",
read_only: bool = False,
create: bool = True,
doc: str = "Zarr store",
warehouse: str | None = None,
profile: str | None = None,
) -> Group
A zarr group stored under the generic table namespace.table.
Needs the zarr extra. Opening for write creates the table if missing,
so pass read_only=True when you only want to look.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
str
|
Generic table holding the zarr store. |
required |
namespace
|
str | None
|
Namespace holding the table. |
None
|
path
|
str
|
Group path within the store. |
''
|
read_only
|
bool
|
Open for reading only. |
False
|
create
|
bool
|
Create the table and group if missing (ignored if |
True
|
doc
|
str
|
Description recorded on a newly created table. |
'Zarr store'
|
warehouse
|
str | None
|
Overrides the warehouse. |
None
|
profile
|
str | None
|
A |
None
|
Example
group = get_zarr_group("harmonie_zarr", namespace="knmi", read_only=True) list(group.keys())