Skip to content

Python API

airflow.providers.lamindb.operators.flow

Operators that open and close the LaminDB flow run of a DAG run.

Both run lamindb inside a virtualenv, so the worker needs no lamindb.

LaminDBFlowInitOperator

LaminDBFlowInitOperator(
    *,
    task_id: str = "lamindb_flow_init",
    is_setup: bool = True,
    lamindb_conn_id: str | None = default_conn_name,
    lamindb_instance: str | None = None,
    lamindb_version: str | None = None,
    lamindb_cache_dir: str | None = None,
    **kwargs: Any,
)

Bases: _LaminDBFlowOperator

Start the LaminDB flow run for this DAG run, in a virtualenv.

Creates (or restarts, on retry) a Run of the DAG file's Transform and tags it with the DAG run so downstream LaminDB steps can find it. Wrap the steps in with init >> finish: to wire them, or let steps with auto_flow=True add and wire one. Returns the flow run uid.

Marked as an Airflow setup task by default, pairing with the teardown LaminDBFlowFinishOperator; pass is_setup=False to opt out. Accepts every PythonVirtualenvOperator argument except python_callable, op_args and op_kwargs.

Source code in src/airflow/providers/lamindb/operators/flow.py
def __init__(
    self,
    *,
    task_id: str = "lamindb_flow_init",
    is_setup: bool = True,
    lamindb_conn_id: str | None = LaminDBHook.default_conn_name,
    lamindb_instance: str | None = None,
    lamindb_version: str | None = None,
    lamindb_cache_dir: str | None = None,
    **kwargs: Any,
) -> None:
    super().__init__(
        task_id=task_id,
        lamindb_conn_id=lamindb_conn_id,
        lamindb_instance=lamindb_instance,
        lamindb_version=lamindb_version,
        lamindb_cache_dir=lamindb_cache_dir,
        **kwargs,
    )
    if is_setup:
        self.as_setup()

LaminDBFlowFinishOperator

LaminDBFlowFinishOperator(
    *,
    task_id: str = "lamindb_flow_finish",
    is_teardown: bool = True,
    lamindb_conn_id: str | None = default_conn_name,
    lamindb_instance: str | None = None,
    lamindb_version: str | None = None,
    lamindb_cache_dir: str | None = None,
    **kwargs: Any,
)

Bases: _LaminDBFlowOperator

Close the LaminDB flow run with the DAG run's outcome, in a virtualenv.

Marked as an Airflow teardown task by default: it runs after every other task (trigger_rule=all_done_setup_success) and is ignored when Airflow decides the DAG run state, so a failed step still fails the DAG run. Marks the flow run errored if any other task in the DAG run failed. Pass is_teardown=False together with your own trigger_rule to opt out. Accepts every PythonVirtualenvOperator argument except python_callable, op_args and op_kwargs.

Source code in src/airflow/providers/lamindb/operators/flow.py
def __init__(
    self,
    *,
    task_id: str = "lamindb_flow_finish",
    is_teardown: bool = True,
    lamindb_conn_id: str | None = LaminDBHook.default_conn_name,
    lamindb_instance: str | None = None,
    lamindb_version: str | None = None,
    lamindb_cache_dir: str | None = None,
    **kwargs: Any,
) -> None:
    if not is_teardown:
        kwargs.setdefault("trigger_rule", TriggerRule.ALL_DONE)
    super().__init__(
        task_id=task_id,
        lamindb_conn_id=lamindb_conn_id,
        lamindb_instance=lamindb_instance,
        lamindb_version=lamindb_version,
        lamindb_cache_dir=lamindb_cache_dir,
        **kwargs,
    )
    if is_teardown:
        self.as_teardown()

airflow.providers.lamindb.decorators.python_virtualenv

@task.lamindb_venv: run the function as a LaminDB step inside a virtualenv.

lamindb_venv_task

lamindb_venv_task(
    python_callable: Callable[..., Any] | None = None,
    multiple_outputs: bool | None = None,
    **kwargs: Any,
)

@task.lamindb_venv: run the function as a LaminDB step inside a virtualenv.

Accepts every @task.virtualenv argument, plus:

  • lamindb_conn_id: Airflow connection of type lamindb with the Lamin API key and the instance; default lamindb_default. The virtualenv gets them instead of the worker's ~/.lamin. None uses lamindb's own configuration instead. Templated, e.g. from an upstream task's XCom.
  • lamindb_instance: instance slug to connect to; overrides the connection's. Templated.
  • lamindb_version: version of lamindb-core added to requirements unless you list lamindb yourself, 2.8.1 or newer; defaults to the instance's version on LaminHub (with a connection), else the latest.
  • lamindb_cache_dir: absolute path of a lamindb cache shared between tasks, set as LAMIN_CACHE_DIR; overrides the connection's cache_dir extra. Templated.
  • auto_flow: wire init >> step >> finish with the DAG's flow operators, adding ones with the same Python, index and LaminDB settings if the DAG has none yet. Default False; mapped steps are never auto-wired.
  • track: record the call in LaminDB. Default True; with False the function runs exactly as under @task.virtualenv, and lamindb is not added to requirements.

The worker needs no lamindb.

Source code in src/airflow/providers/lamindb/decorators/python_virtualenv.py
def lamindb_venv_task(
    python_callable: Callable[..., Any] | None = None,
    multiple_outputs: bool | None = None,
    **kwargs: Any,
):
    """``@task.lamindb_venv``: run the function as a LaminDB step inside a virtualenv.

    Accepts every ``@task.virtualenv`` argument, plus:

    - ``lamindb_conn_id``: Airflow connection of type ``lamindb`` with the Lamin API key
      and the instance; default ``lamindb_default``. The virtualenv gets them instead of
      the worker's ``~/.lamin``. ``None`` uses lamindb's own configuration instead.
      Templated, e.g. from an upstream task's XCom.
    - ``lamindb_instance``: instance slug to connect to; overrides the connection's. Templated.
    - ``lamindb_version``: version of ``lamindb-core`` added to ``requirements`` unless
      you list lamindb yourself, 2.8.1 or newer; defaults to the instance's version on
      LaminHub (with a connection), else the latest.
    - ``lamindb_cache_dir``: absolute path of a lamindb cache shared between tasks, set as
      ``LAMIN_CACHE_DIR``; overrides the connection's ``cache_dir`` extra. Templated.
    - ``auto_flow``: wire ``init >> step >> finish`` with the DAG's flow operators,
      adding ones with the same Python, index and LaminDB settings if the DAG has none
      yet. Default ``False``; mapped steps are never auto-wired.
    - ``track``: record the call in LaminDB. Default ``True``; with ``False`` the
      function runs exactly as under ``@task.virtualenv``, and lamindb is not added
      to ``requirements``.

    The worker needs no lamindb.
    """
    return task_decorator_factory(
        python_callable=python_callable,
        multiple_outputs=multiple_outputs,
        decorated_operator_class=LaminDBVenvDecoratedOperator,
        **kwargs,
    )

airflow.providers.lamindb.decorators.kubernetes

@task.lamindb_k8s: run the function as a LaminDB step in a Kubernetes pod.

lamindb_k8s_task

lamindb_k8s_task(
    python_callable: Callable[..., Any] | None = None,
    multiple_outputs: bool | None = None,
    **kwargs: Any,
)

@task.lamindb_k8s: run the function as a LaminDB step in a Kubernetes pod.

Accepts every @task.kubernetes argument, plus lamindb_conn_id (Airflow connection of type lamindb; the pod only gets its instance, not its API key), lamindb_instance (instance slug; overrides the connection's; both templated), auto_flow (wire flow operators, which run in a virtualenv on the worker, if the DAG has none yet; default False) and track (record the call in LaminDB; with False it runs exactly as under @task.kubernetes). The image must have lamindb 2.8.1 or newer installed (the step fails on older versions) and credentials for the instance, e.g. LAMIN_API_KEY from a Kubernetes secret. The worker needs no lamindb. Requires pip install "apache-airflow-providers-lamindb[cncf.kubernetes]".

The step needs the lamindb_default connection (or the one named by lamindb_conn_id) and fails if it is missing. Pass lamindb_conn_id=None to use only the pod's own lamindb configuration, together with lamindb_instance to pin the instance. The auto-wired flow operators get the same lamindb_conn_id, so with None they use the worker's lamindb configuration (LAMIN_API_KEY, LAMIN_CURRENT_INSTANCE, ~/.lamin) in their virtualenv.

Source code in src/airflow/providers/lamindb/decorators/kubernetes.py
def lamindb_k8s_task(
    python_callable: Callable[..., Any] | None = None,
    multiple_outputs: bool | None = None,
    **kwargs: Any,
):
    """``@task.lamindb_k8s``: run the function as a LaminDB step in a Kubernetes pod.

    Accepts every ``@task.kubernetes`` argument, plus ``lamindb_conn_id`` (Airflow
    connection of type ``lamindb``; the pod only gets its instance, not its API key),
    ``lamindb_instance`` (instance slug; overrides the connection's; both templated),
    ``auto_flow`` (wire flow operators, which run in a virtualenv on the worker, if the
    DAG has none yet; default ``False``) and ``track`` (record the call in LaminDB; with
    ``False`` it runs exactly as under ``@task.kubernetes``). The image must have lamindb 2.8.1
    or newer installed (the step fails on older versions) and credentials for the instance,
    e.g. ``LAMIN_API_KEY`` from a Kubernetes secret. The worker needs no lamindb. Requires
    ``pip install "apache-airflow-providers-lamindb[cncf.kubernetes]"``.

    The step needs the ``lamindb_default`` connection (or the one named by
    ``lamindb_conn_id``) and fails if it is missing. Pass ``lamindb_conn_id=None`` to
    use only the pod's own lamindb configuration, together with ``lamindb_instance`` to
    pin the instance. The auto-wired flow operators get the same ``lamindb_conn_id``, so
    with ``None`` they use the worker's lamindb configuration (``LAMIN_API_KEY``,
    ``LAMIN_CURRENT_INSTANCE``, ``~/.lamin``) in their virtualenv.
    """
    try:
        operator_class = _lamindb_k8s_decorated_operator_class()
    except ImportError as e:
        raise ImportError(
            "@task.lamindb_k8s requires apache-airflow-providers-cncf-kubernetes. "
            'Install with: pip install "apache-airflow-providers-lamindb[cncf.kubernetes]"'
        ) from e

    return task_decorator_factory(
        python_callable=python_callable,
        multiple_outputs=multiple_outputs,
        decorated_operator_class=operator_class,
        **kwargs,
    )

airflow.providers.lamindb.triggers.records

LaminDBRecordEventTrigger

LaminDBRecordEventTrigger(
    registry: str,
    *,
    events: str | Sequence[str] = ("created",),
    branch: str | int | None = "main",
    filter: FilterLike | None = None,
    changed_fields: Sequence[str] | None = None,
    **kwargs: Any,
)

Bases: LaminDBDbWriteEventTrigger

Fire an event for every record of a LaminDB registry that is created, updated or deleted.

Use it in an AssetWatcher to schedule DAGs on LaminDB changes. Each event payload contains the event (created/updated/deleted), the current record (None for hard deletes), the previous values logged with the write, the changed_fields of updates, changed_by and the underlying dbwrite log entry.

With branch set (main by default), events are relative to that branch: created also covers records that arrive on the branch by merging a contribution branch or by restoring them from the trash or archive, and deleted also covers records moved off the branch, for example to the trash via record.delete(). For registries without branches, branch is ignored.

Parameters:

  • registry (str) –

    Registry to watch, e.g. LaminDBRegistry.COLLECTION, "core.run", "core.record" or "bionty.celltype".

  • events (str | Sequence[str], default: ('created',) ) –

    Events to report, any of created, updated and deleted.

  • branch (str | int | None, default: 'main' ) –

    Name or id of the branch to watch; None reports raw inserts, updates and deletes on all branches.

  • filter (FilterLike | None, default: None ) –

    Filter the record must match, built with F, e.g. F(ArtifactField.KEY).startswith("raw/"), or a LaminHub REST filter such as {"key": {"startswith": "raw/"}}. It's evaluated against the current record; for hard deletes against the deleted row, which only supports direct fields.

  • changed_fields (Sequence[str] | None, default: None ) –

    Only report updates that change at least one of these fields, e.g. [ArtifactField.KEY].

    Records that hold trigger cursors (see cursor_store) are never reported. They are recognized by the registry and reference_type of this trigger's own RecordCursorStore (by default core.record and airflow_trigger_cursor), so give triggers that store cursors in the registry they watch the same settings.

Source code in src/airflow/providers/lamindb/triggers/records.py
def __init__(
    self,
    registry: str,
    *,
    events: str | Sequence[str] = ("created",),
    branch: str | int | None = "main",
    filter: FilterLike | None = None,
    changed_fields: Sequence[str] | None = None,
    **kwargs: Any,
) -> None:
    super().__init__(**kwargs)
    self.registry: str = plain_value(registry)
    self.events = _normalize_events(events)
    self.branch = branch
    self.filter = normalize_filter(filter)
    self.changed_fields = normalize_str_list(changed_fields) if changed_fields else None
    if "deleted" in self.events and not is_local_filter(self._record_filter()):
        raise ValueError(
            "'deleted' events only support filters on direct fields of the record "
            "(no relation or JSON paths), because deleted records can't be queried anymore."
        )
    if (
        isinstance(self.cursor_store, RecordCursorStore)
        and self.cursor_store.reference_type is None
        and normalize_registry_name(self.cursor_store.registry) == normalize_registry_name(self.registry)
    ):
        raise ValueError(
            "This trigger stores its cursor in the registry it watches, so it needs a "
            "reference_type to recognize its own saves instead of reacting to them."
        )
    self._registry: Registry | None = None
    self._branch_id: int | None = None
    # how cursor records look: this trigger's own record cursor store, or the defaults
    self._cursor_settings = (
        self.cursor_store if isinstance(self.cursor_store, RecordCursorStore) else RecordCursorStore()
    )
    self._cursor_record_ids: set[int] = set()
    self._watches_cursor_records = False

LaminDBArtifactEventTrigger

LaminDBArtifactEventTrigger(
    *,
    key: str | None = None,
    key_prefix: str | None = None,
    suffix: str | Sequence[str] | None = None,
    kind: str | Sequence[str] | None = None,
    include_internal: bool = False,
    wait_for_upload: bool = True,
    **kwargs: Any,
)

Bases: LaminDBRecordEventTrigger

Fire an event for every LaminDB artifact that is created, updated or deleted.

A specialization of LaminDBRecordEventTrigger for core.artifact. By default, the created event fires only once the artifact's upload to storage has completed (wait_for_upload), so that downstream tasks can load it right away. Artifacts that LaminDB creates internally (run logs, environments) are ignored unless include_internal is set.

Parameters:

  • key (str | None, default: None ) –

    Only artifacts with this exact key.

  • key_prefix (str | None, default: None ) –

    Only artifacts whose key starts with this prefix, e.g. "raw/".

  • suffix (str | Sequence[str] | None, default: None ) –

    Only artifacts with this suffix (or any of these suffixes), e.g. ".parquet".

  • kind (str | Sequence[str] | None, default: None ) –

    Only artifacts of this kind (or any of these kinds), e.g. ArtifactKind.DATASET.

  • include_internal (bool, default: False ) –

    Also report artifacts LaminDB creates internally.

  • wait_for_upload (bool, default: True ) –

    Report created only once the upload to storage has completed and skip updates of artifacts that are being uploaded.

  • events –
  • branch –
  • filter –

    Additional filter, see LaminDBRecordEventTrigger.

  • changed_fields –
Source code in src/airflow/providers/lamindb/triggers/records.py
def __init__(
    self,
    *,
    key: str | None = None,
    key_prefix: str | None = None,
    suffix: str | Sequence[str] | None = None,
    kind: str | Sequence[str] | None = None,
    include_internal: bool = False,
    wait_for_upload: bool = True,
    **kwargs: Any,
) -> None:
    kwargs.pop("registry", None)
    self.key = key
    self.key_prefix = key_prefix
    self.suffix = normalize_str_list(suffix)
    self.kind = normalize_str_list(kind)
    self.include_internal = include_internal
    self.wait_for_upload = wait_for_upload
    super().__init__("core.artifact", **kwargs)

airflow.providers.lamindb.triggers.branches

LaminDBBranchStatusEventTrigger

LaminDBBranchStatusEventTrigger(
    *,
    to_status: str | Sequence[str] | None = None,
    from_status: str | Sequence[str] | None = None,
    branch_name: str | Sequence[str] | None = None,
    **kwargs: Any,
)

Bases: LaminDBDbWriteEventTrigger

Fire an event whenever the status of a LaminDB branch changes.

Branch statuses are standalone, draft and review (a Change Request is open), and merged and closed. The event payload contains from_status, to_status, the branch (with its current status), changed_by and the underlying dbwrite entry.

Parameters:

  • to_status (str | Sequence[str] | None, default: None ) –

    Only report transitions to this status (or any of these statuses).

  • from_status (str | Sequence[str] | None, default: None ) –

    Only report transitions from this status (or any of these statuses).

  • branch_name (str | Sequence[str] | None, default: None ) –

    Only report branches whose name matches this glob pattern (or any of these patterns), e.g. "release-*".

Source code in src/airflow/providers/lamindb/triggers/branches.py
def __init__(
    self,
    *,
    to_status: str | Sequence[str] | None = None,
    from_status: str | Sequence[str] | None = None,
    branch_name: str | Sequence[str] | None = None,
    **kwargs: Any,
) -> None:
    super().__init__(**kwargs)
    self.to_status = normalize_statuses(to_status, name="to_status")
    self.from_status = normalize_statuses(from_status, name="from_status")
    self.branch_name = normalize_str_list(branch_name)

LaminDBBranchBlockEventTrigger

LaminDBBranchBlockEventTrigger(
    *,
    kinds: str | Sequence[str] = BLOCK_KINDS,
    branch_name: str | Sequence[str] | None = None,
    **kwargs: Any,
)

Bases: LaminDBDbWriteEventTrigger

Fire an event whenever a comment or readme is added to a LaminDB branch.

Comments and readmes are core.branchblock records; a new readme version is a new block. The event payload contains the kind, the block (including its Markdown content), the branch, changed_by and the underlying dbwrite entry.

Parameters:

  • kinds (str | Sequence[str], default: BLOCK_KINDS ) –

    Block kinds to report, comment and/or readme.

  • branch_name (str | Sequence[str] | None, default: None ) –

    Only report blocks on branches whose name matches this glob pattern (or any of these patterns).

Source code in src/airflow/providers/lamindb/triggers/branches.py
def __init__(
    self,
    *,
    kinds: str | Sequence[str] = BLOCK_KINDS,
    branch_name: str | Sequence[str] | None = None,
    **kwargs: Any,
) -> None:
    super().__init__(**kwargs)
    self.kinds = normalize_str_list(kinds) or []
    invalid = [kind for kind in self.kinds if kind not in BLOCK_KINDS]
    if invalid or not self.kinds:
        raise ValueError(
            f"Invalid block kinds {self.kinds}; expected a non-empty subset of {BLOCK_KINDS}"
        )
    self.branch_name = normalize_str_list(branch_name)

airflow.providers.lamindb.triggers.base

LaminDBDbWriteEventTrigger

LaminDBDbWriteEventTrigger(
    *,
    lamindb_conn_id: str | None = default_conn_name,
    instance: str | None = None,
    poll_interval: float = 30.0,
    batch_size: int = MAX_PAGE_SIZE,
    max_batches_per_poll: int = 10,
    cursor_store: CursorStore | Mapping[str, Any] | None = None,
)

Bases: BaseEventTrigger

Base class for event-driven scheduling triggers that watch the LaminHub database write log.

LaminHub logs every INSERT, UPDATE and DELETE on a LaminDB instance's database in the hubmodule.dbwrite registry ("Changes → Database writes" in the LaminHub UI). Subclasses define which writes to poll and how to turn them into trigger events.

The trigger polls writes with an id greater than its cursor, and stores the cursor under state_key so that a restarted triggerer resumes where it left off. The cursor is committed at least commit_delay seconds after the events were yielded, which gives Airflow time to persist them: events are delivered at least once. It is only committed when the trigger processed new writes. On the first start the trigger only reports writes that happen from then on.

Parameters:

  • lamindb_conn_id (str | None, default: default_conn_name ) –

    Airflow connection of type lamindb.

  • instance (str | None, default: None ) –

    LaminDB instance owner/name; overrides the connection's instance.

  • poll_interval (float, default: 30.0 ) –

    Seconds between polls of the write log.

  • batch_size (int, default: MAX_PAGE_SIZE ) –

    Number of writes fetched per request (at most 200).

  • max_batches_per_poll (int, default: 10 ) –

    Maximum number of batches processed per poll cycle.

  • cursor_store (CursorStore | Mapping[str, Any] | None, default: None ) –

    Where and how to store the cursor: AssetCursorStore (default) in the asset state store of the AssetWatcher's assets, or RecordCursorStore in a record of the watched instance. Both also set the commit_delay.

Source code in src/airflow/providers/lamindb/triggers/base.py
def __init__(
    self,
    *,
    lamindb_conn_id: str | None = LaminDBHook.default_conn_name,
    instance: str | None = None,
    poll_interval: float = 30.0,
    batch_size: int = MAX_PAGE_SIZE,
    max_batches_per_poll: int = 10,
    cursor_store: CursorStore | Mapping[str, Any] | None = None,
) -> None:
    super().__init__()
    if poll_interval <= 0:
        raise ValueError("poll_interval must be positive")
    if not 1 <= batch_size <= MAX_PAGE_SIZE:
        raise ValueError(f"batch_size must be between 1 and {MAX_PAGE_SIZE}")
    if max_batches_per_poll < 1:
        raise ValueError("max_batches_per_poll must be at least 1")
    self.lamindb_conn_id = lamindb_conn_id
    self.instance = instance
    self.poll_interval = poll_interval
    self.batch_size = batch_size
    self.max_batches_per_poll = max_batches_per_poll
    self.cursor_store = CursorStore.coerce(cursor_store)
    self._users: dict[int, dict[str, Any]] = {}

state_key property

state_key: str

Key of the cursor (and default name of its record); changes when the trigger's filters change.

airflow.providers.lamindb.triggers.cursors

Where the event triggers keep the id of the last processed database write.

Pass a trigger cursor_store=AssetCursorStore() (the default) to keep it in the watched asset's Airflow asset state store, or cursor_store=RecordCursorStore() to keep it in a record of the watched instance itself.

DEFAULT_COMMIT_DELAY module-attribute

DEFAULT_COMMIT_DELAY = 5.0

Default minimum seconds between yielding events and committing the cursor past them.

CursorStore dataclass

CursorStore(*, commit_delay: float = DEFAULT_COMMIT_DELAY)

Where and how an event trigger keeps its cursor; use a subclass.

Parameters:

  • commit_delay (float, default: DEFAULT_COMMIT_DELAY ) –

    Minimum seconds between yielding events and committing the cursor past them, which gives Airflow time to persist the events. Longer delays save less often, but redeliver more events after a crash.

coerce classmethod

coerce(value: CursorStore | Mapping[str, Any] | None) -> CursorStore

Accept a store, its serialize form (as in serialized trigger kwargs) or None.

Source code in src/airflow/providers/lamindb/triggers/cursors.py
@classmethod
def coerce(cls, value: CursorStore | Mapping[str, Any] | None) -> CursorStore:
    """Accept a store, its ``serialize`` form (as in serialized trigger kwargs) or None."""
    if value is None:
        return AssetCursorStore()
    if isinstance(value, CursorStore):
        return value
    if not isinstance(value, Mapping):
        raise TypeError(f"cursor_store must be a CursorStore, e.g. RecordCursorStore(), got {value!r}")
    settings = dict(value)
    store_type = CursorStore._types.get(settings.pop("type", None))
    if store_type is None:
        raise ValueError(f"cursor_store type must be one of {sorted(CursorStore._types)}, got {value!r}")
    unknown = set(settings) - {f.name for f in fields(store_type)}
    if unknown:
        raise ValueError(f"Unknown {store_type.__name__} settings: {sorted(unknown)}")
    return store_type(**settings)

open

open(
    *, hook: LaminDBHook, asset_state_store: Any, key: str, description: str
) -> CursorBackend

The backend that loads and saves the cursor under key while the trigger runs.

Source code in src/airflow/providers/lamindb/triggers/cursors.py
def open(self, *, hook: LaminDBHook, asset_state_store: Any, key: str, description: str) -> CursorBackend:
    """The backend that loads and saves the cursor under ``key`` while the trigger runs."""
    raise NotImplementedError

AssetCursorStore dataclass

AssetCursorStore(*, commit_delay: float = DEFAULT_COMMIT_DELAY)

Bases: CursorStore

Keep the cursor in the asset state store of the AssetWatcher's assets.

The cursor lives in Airflow's metadata database next to the asset events. A trigger outside an AssetWatcher has no asset state store and keeps its cursor in memory only.

RecordCursorStore dataclass

RecordCursorStore(
    *,
    commit_delay: float = DEFAULT_COMMIT_DELAY,
    registry: str = "core.record",
    field: str = "extra_data",
    record_type: str | None = CURSOR_RECORD_TYPE_NAME,
    reference_type: str | None = CURSOR_REFERENCE_TYPE,
    branch: str | int = "main",
    space: str | int | None = None,
    name: str | None = None,
    description: str | None = None,
)

Bases: CursorStore

Keep the cursor in a record of the watched instance; needs write access to the instance.

The defaults keep each trigger's cursor in its own core.record on main, grouped under the record type Airflow trigger cursors. The record and its type are created on the first save. Deleting the record resets the cursor when the trigger restarts; a running trigger creates the record again on its next save.

Parameters:

  • registry (str, default: 'core.record' ) –

    Registry of the cursor records. It needs the fields name, branch, space and field, plus reference_type and type/is_type unless those are disabled below.

  • field (str, default: 'extra_data' ) –

    JSON field that holds the cursor, {"dbwrite_id": ..., "instance_id": ...}.

  • record_type (str | None, default: CURSOR_RECORD_TYPE_NAME ) –

    Name of the record type (is_type=True) that groups the cursor records; None for no type, for registries without types.

  • reference_type (str | None, default: CURSOR_REFERENCE_TYPE ) –

    Marker in reference_type that identifies cursor records, so that record triggers on registry can skip them; None for no marker. Then such triggers report the cursor records like any other record. A record trigger watching registry itself needs a marker, so it rejects None.

  • branch (str | int, default: 'main' ) –

    Branch (name or id) of the cursor records and their type.

  • space (str | int | None, default: None ) –

    Space (name or id) of the cursor records and their type, e.g. a restricted space that only the Airflow API key can write to; None for LaminHub's default space.

  • name (str | None, default: None ) –

    Name of the cursor record; None for the trigger's state_key. A fixed name must be unique per trigger, or triggers overwrite each other's cursors.

  • description (str | None, default: None ) –

    Description of the cursor record; None to describe the trigger.

  • commit_delay (float, default: DEFAULT_COMMIT_DELAY ) –

airflow.providers.lamindb.sensors.branches

LaminDBBranchStatusSensor

LaminDBBranchStatusSensor(
    *,
    branch: str | int,
    target_status: str | Sequence[str] = "merged",
    failure_status: str | Sequence[str] = ("closed",),
    lamindb_conn_id: str | None = default_conn_name,
    instance: str | None = None,
    deferrable: bool = getboolean("operators", "default_deferrable", fallback=False),
    **kwargs: Any,
)

Bases: BaseSensorOperator

Wait until a LaminDB branch reaches a status, e.g. until its Change Request is merged.

Returns the branch (with its status), which is pushed to XCom. Fails without retries if the branch reaches one of the failure_status statuses (by default, when the Change Request is closed without merging). Network errors, rate limiting and LaminHub server errors don't end the wait; the sensor checks again later.

For more information on how to use this sensor, take a look at the guide.

Parameters:

  • branch (str | int) –

    Branch name or id.

  • target_status (str | Sequence[str], default: 'merged' ) –

    Status (or statuses) to wait for, any of standalone, draft, review, merged and closed.

  • failure_status (str | Sequence[str], default: ('closed',) ) –

    Status (or statuses) that fail the sensor.

  • lamindb_conn_id (str | None, default: default_conn_name ) –

    Airflow connection of type lamindb.

  • instance (str | None, default: None ) –

    LaminDB instance owner/name; overrides the connection's instance.

  • deferrable (bool, default: getboolean('operators', 'default_deferrable', fallback=False) ) –

    Wait in the triggerer instead of occupying a worker slot.

Source code in src/airflow/providers/lamindb/sensors/branches.py
def __init__(
    self,
    *,
    branch: str | int,
    target_status: str | Sequence[str] = "merged",
    failure_status: str | Sequence[str] = ("closed",),
    lamindb_conn_id: str | None = LaminDBHook.default_conn_name,
    instance: str | None = None,
    deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
    **kwargs: Any,
) -> None:
    super().__init__(**kwargs)
    self.branch = branch
    self.target_status = normalize_statuses(target_status, name="target_status") or []
    self.failure_status = normalize_statuses(failure_status, name="failure_status") or []
    if not self.target_status:
        raise ValueError("target_status must not be empty")
    if overlap := set(self.target_status) & set(self.failure_status):
        raise ValueError(f"Statuses {sorted(overlap)} are both target and failure statuses")
    self.lamindb_conn_id = lamindb_conn_id
    self.instance = instance
    self.deferrable = deferrable

airflow.providers.lamindb.sensors.records

LaminDBRecordSensor

LaminDBRecordSensor(
    *,
    registry: str,
    filter: FilterLike | None = None,
    branch: str | int | None = "main",
    min_count: int = 1,
    limit: int = 100,
    wait_for_upload: bool | None = None,
    lamindb_conn_id: str | None = default_conn_name,
    instance: str | None = None,
    deferrable: bool = getboolean("operators", "default_deferrable", fallback=False),
    **kwargs: Any,
)

Bases: BaseSensorOperator

Wait until records matching a filter exist in a LaminDB registry.

Returns the matching records (newest first, at most limit), which are pushed to XCom. Network errors, rate limiting and LaminHub server errors don't end the wait; the sensor checks again later.

For more information on how to use this sensor, take a look at the guide.

Parameters:

  • registry (str) –

    Registry to query, e.g. LaminDBRegistry.RUN, "core.artifact" or "bionty.celltype".

  • filter (FilterLike | None, default: None ) –

    Filter built with F, e.g. F(ArtifactField.KEY) == "raw/sample1.fastq.gz", or a LaminHub REST filter such as {"key": {"eq": "raw/sample1.fastq.gz"}}. It's validated when the DAG is parsed.

  • branch (str | int | None, default: 'main' ) –

    Only records on this branch (name or id); None for all branches and for registries without branches.

  • min_count (int, default: 1 ) –

    Number of matching records to wait for.

  • limit (int, default: 100 ) –

    Maximum number of records returned.

  • wait_for_upload (bool | None, default: None ) –

    Ignore artifacts whose upload to storage is still in progress.

  • lamindb_conn_id (str | None, default: default_conn_name ) –

    Airflow connection of type lamindb.

  • instance (str | None, default: None ) –

    LaminDB instance owner/name; overrides the connection's instance.

  • deferrable (bool, default: getboolean('operators', 'default_deferrable', fallback=False) ) –

    Wait in the triggerer instead of occupying a worker slot.

Source code in src/airflow/providers/lamindb/sensors/records.py
def __init__(
    self,
    *,
    registry: str,
    filter: FilterLike | None = None,
    branch: str | int | None = "main",
    min_count: int = 1,
    limit: int = 100,
    wait_for_upload: bool | None = None,
    lamindb_conn_id: str | None = LaminDBHook.default_conn_name,
    instance: str | None = None,
    deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
    **kwargs: Any,
) -> None:
    super().__init__(**kwargs)
    if min_count < 1 or limit < min_count:
        raise ValueError("min_count must be at least 1 and not larger than limit")
    self.registry: str = plain_value(registry)
    self.filter = normalize_filter(filter)
    self.branch = branch
    self.min_count = min_count
    self.limit = limit
    self.wait_for_upload = wait_for_upload
    self.lamindb_conn_id = lamindb_conn_id
    self.instance = instance
    self.deferrable = deferrable

LaminDBArtifactSensor

LaminDBArtifactSensor(
    *,
    key: str | None = None,
    key_prefix: str | None = None,
    suffix: str | Sequence[str] | None = None,
    kind: str | Sequence[str] | None = None,
    include_internal: bool = False,
    wait_for_upload: bool = True,
    **kwargs: Any,
)

Bases: LaminDBRecordSensor

Wait until LaminDB artifacts matching some criteria exist and their upload has completed.

Returns the matching artifacts (newest first, at most limit), which are pushed to XCom.

For more information on how to use this sensor, take a look at the guide.

Parameters:

  • key (str | None, default: None ) –

    Artifact key, e.g. "raw/sample1.fastq.gz".

  • key_prefix (str | None, default: None ) –

    Key prefix, e.g. "raw/".

  • suffix (str | Sequence[str] | None, default: None ) –

    Suffix (or suffixes), e.g. ".parquet".

  • kind (str | Sequence[str] | None, default: None ) –

    Artifact kind (or kinds), e.g. ArtifactKind.DATASET.

  • include_internal (bool, default: False ) –

    Also consider artifacts LaminDB creates internally (run logs, ...).

  • filter –

    Additional filter, see LaminDBRecordSensor.

  • wait_for_upload (bool, default: True ) –

    Ignore artifacts whose upload is still in progress (default).

Source code in src/airflow/providers/lamindb/sensors/records.py
def __init__(
    self,
    *,
    key: str | None = None,
    key_prefix: str | None = None,
    suffix: str | Sequence[str] | None = None,
    kind: str | Sequence[str] | None = None,
    include_internal: bool = False,
    wait_for_upload: bool = True,
    **kwargs: Any,
) -> None:
    kwargs.pop("registry", None)
    super().__init__(registry="core.artifact", wait_for_upload=wait_for_upload, **kwargs)
    self.key = key
    self.key_prefix = key_prefix
    self.suffix = normalize_str_list(suffix)
    self.kind = normalize_str_list(kind)
    self.include_internal = include_internal

airflow.providers.lamindb.hooks.lamindb

DEFAULT_HUB_API_URL module-attribute

DEFAULT_HUB_API_URL = 'https://aws.us-east-1.lamin.ai/api'

LaminDBHook

LaminDBHook(
    lamindb_conn_id: str | None = default_conn_name,
    instance: str | None = None,
    *,
    timeout: float = 30.0,
    retries: int = 3,
    retry_backoff: float = 1.0,
    **kwargs: Any,
)

Bases: BaseHook

Interact with LaminDB instances hosted on LaminHub via the LaminHub REST API.

The connection's password is a Lamin API key; it is exchanged for a short-lived access token that is refreshed automatically. Without an API key, requests are anonymous, which works for public instances. The instance (owner/name) is read from the connection's instance extra and can be overridden per hook. Instances on lamindb older than 2.8.1 are rejected with LaminDBVersionError.

Parameters:

  • lamindb_conn_id (str | None, default: default_conn_name ) –

    Airflow connection of type lamindb. None means anonymous access with default settings, which requires instance to be passed.

  • instance (str | None, default: None ) –

    LaminDB instance slug owner/name. Overrides the connection's instance.

  • timeout (float, default: 30.0 ) –

    Timeout for HTTP requests in seconds.

  • retries (int, default: 3 ) –

    Number of retries for connection errors and retryable HTTP status codes (429 and 5xx).

  • retry_backoff (float, default: 1.0 ) –

    Base delay in seconds for the exponential retry backoff.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def __init__(
    self,
    lamindb_conn_id: str | None = default_conn_name,
    instance: str | None = None,
    *,
    timeout: float = 30.0,
    retries: int = 3,
    retry_backoff: float = 1.0,
    **kwargs: Any,
) -> None:
    super().__init__(**kwargs)
    self.lamindb_conn_id = lamindb_conn_id
    self.instance_slug = instance
    self.timeout = timeout
    self.retries = retries
    self.retry_backoff = retry_backoff
    self._config: _HubConfig | None = None
    self._access_token: str | None = None
    self._access_token_expiry = 0.0
    self._instance: LaminDBInstance | None = None
    self._schema: dict[str, Any] | None = None
    self._client: httpx.Client | None = None
    self._async_client: httpx.AsyncClient | None = None

get_conn

get_conn() -> Client

Return the (lazily created) synchronous HTTP client.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_conn(self) -> httpx.Client:
    """Return the (lazily created) synchronous HTTP client."""
    if self._client is None:
        self._client = httpx.Client(timeout=self.timeout, headers={"User-Agent": _USER_AGENT})
    return self._client

get_async_conn

get_async_conn() -> AsyncClient

Return the (lazily created) asynchronous HTTP client.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_async_conn(self) -> httpx.AsyncClient:
    """Return the (lazily created) asynchronous HTTP client."""
    if self._async_client is None:
        self._async_client = httpx.AsyncClient(timeout=self.timeout, headers={"User-Agent": _USER_AGENT})
    return self._async_client

get_instance_slug

get_instance_slug() -> str

Return the configured instance owner/name without contacting LaminHub.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_instance_slug(self) -> str:
    """Return the configured instance ``owner/name`` without contacting LaminHub."""
    config = self._get_config()
    return f"{config.owner}/{config.name}"

get_api_key

get_api_key() -> str | None

Return the connection's Lamin API key, or None for anonymous access.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_api_key(self) -> str | None:
    """Return the connection's Lamin API key, or ``None`` for anonymous access."""
    return self._get_config().api_key

get_cache_dir

get_cache_dir() -> str | None

Return the connection's cache_dir extra: the lamindb cache shared by virtualenv tasks.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_cache_dir(self) -> str | None:
    """Return the connection's ``cache_dir`` extra: the lamindb cache shared by virtualenv tasks."""
    return self._get_config().cache_dir

get_instance

get_instance() -> LaminDBInstance

Return the configured instance (resolves its id and regional API URL on first use).

Raises LaminDBVersionError if the instance runs lamindb older than 2.8.1.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_instance(self) -> LaminDBInstance:
    """
    Return the configured instance (resolves its id and regional API URL on first use).

    Raises [`LaminDBVersionError`][airflow.providers.lamindb.exceptions.LaminDBVersionError] if the
    instance runs lamindb older than 2.8.1.
    """
    if self._instance is None:
        config = self._get_config()
        settings = self._send("GET", self._settings_url(config))
        self._instance = self._instance_from_settings(config, settings)
    return self._instance

get_schema

get_schema() -> dict[str, Any]

Return the instance schema: {module: {model: {"table_name": ..., "fields": ...}}}.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_schema(self) -> dict[str, Any]:
    """Return the instance schema: ``{module: {model: {"table_name": ..., "fields": ...}}}``."""
    if self._schema is None:
        instance = self.get_instance()
        self._schema = self._send("GET", f"{instance.api_url}/instances/{instance.id}/schema")
    return self._schema

get_registry

get_registry(registry: str | Registry) -> Registry

Resolve a registry name such as core.artifact or bionty.gene.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_registry(self, registry: str | Registry) -> Registry:
    """Resolve a registry name such as ``core.artifact`` or ``bionty.gene``."""
    if isinstance(registry, Registry):
        return registry
    if registry.lower().startswith("hubmodule."):
        return resolve_registry({}, registry)
    return resolve_registry(self.get_schema(), registry)

query_records

query_records(
    registry: str | Registry,
    filter: FilterLike | None = None,
    *,
    select: Sequence[str] | None = None,
    order_by: Sequence[str | Mapping[str, Any]] | None = None,
    limit: int = 50,
    offset: int = 0,
    include_foreign_keys: bool = True,
    search: str | None = None,
    branch_ids: Sequence[int] | None = None,
) -> list[dict[str, Any]]

Query records of a registry.

Parameters:

  • registry (str | Registry) –

    Registry name such as core.artifact, core.run or bionty.gene, or a LaminDBRegistry member.

  • filter (FilterLike | None, default: None ) –

    Filter built with F, e.g. F(ArtifactField.SUFFIX) == ".csv", or a LaminHub REST filter such as {"suffix": {"eq": ".csv"}}, see https://docs.lamin.ai/rest

  • select (Sequence[str] | None, default: None ) –

    Fields (and relations such as created_by(handle)) to return.

  • order_by (Sequence[str | Mapping[str, Any]] | None, default: None ) –

    Sort order, for example ["-created_at"]. Defaults to ascending id.

  • limit (int, default: 50 ) –

    Maximum number of records; requests are paginated in pages of 200.

  • offset (int, default: 0 ) –

    Number of records to skip.

  • include_foreign_keys (bool, default: True ) –

    Include foreign key columns (run_id, branch_id, ...).

  • search (str | None, default: None ) –

    Full-text search string.

  • branch_ids (Sequence[int] | None, default: None ) –

    Restrict the query scope to these branch ids.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def query_records(
    self,
    registry: str | Registry,
    filter: FilterLike | None = None,
    *,
    select: Sequence[str] | None = None,
    order_by: Sequence[str | Mapping[str, Any]] | None = None,
    limit: int = 50,
    offset: int = 0,
    include_foreign_keys: bool = True,
    search: str | None = None,
    branch_ids: Sequence[int] | None = None,
) -> list[dict[str, Any]]:
    """
    Query records of a registry.

    :param registry: Registry name such as ``core.artifact``, ``core.run`` or ``bionty.gene``,
        or a [`LaminDBRegistry`][airflow.providers.lamindb.utils.enums.LaminDBRegistry] member.
    :param filter: Filter built with [`F`][airflow.providers.lamindb.utils.filters.F], e.g.
        ``F(ArtifactField.SUFFIX) == ".csv"``, or a LaminHub REST filter such as
        ``{"suffix": {"eq": ".csv"}}``, see https://docs.lamin.ai/rest
    :param select: Fields (and relations such as ``created_by(handle)``) to return.
    :param order_by: Sort order, for example ``["-created_at"]``. Defaults to ascending ``id``.
    :param limit: Maximum number of records; requests are paginated in pages of 200.
    :param offset: Number of records to skip.
    :param include_foreign_keys: Include foreign key columns (``run_id``, ``branch_id``, ...).
    :param search: Full-text search string.
    :param branch_ids: Restrict the query scope to these branch ids.
    """
    reg = self.get_registry(registry)
    instance = self.get_instance()
    results: list[dict[str, Any]] = []
    while len(results) < limit:
        page_size = min(MAX_PAGE_SIZE, limit - len(results))
        url, params, body = self._records_request(
            instance,
            reg,
            filter=filter,
            select=select,
            order_by=order_by,
            limit=page_size,
            offset=offset + len(results),
            include_foreign_keys=include_foreign_keys,
            search=search,
            branch_ids=branch_ids,
        )
        page = self._check_page(self._send("POST", url, params=params, json=body), reg)
        results.extend(page)
        if len(page) < page_size:
            break
    return results

get_records_by_ids

get_records_by_ids(
    registry: str | Registry, ids: Iterable[int], filter: FilterLike | None = None
) -> dict[int, dict[str, Any]]

Fetch records by id, optionally restricted by an additional filter. Returns {id: record}.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_records_by_ids(
    self, registry: str | Registry, ids: Iterable[int], filter: FilterLike | None = None
) -> dict[int, dict[str, Any]]:
    """Fetch records by id, optionally restricted by an additional filter. Returns ``{id: record}``."""
    records: dict[int, dict[str, Any]] = {}
    for chunk in chunk_ids(ids):
        combined = combine_filters({"id": {"in": chunk}}, filter)
        for record in self.query_records(registry, combined, limit=len(chunk)):
            records[record["id"]] = record
    return records

query_dbwrites

query_dbwrites(
    filter: FilterLike | None = None,
    *,
    after_id: int | None = None,
    limit: int = MAX_PAGE_SIZE,
    descending: bool = False,
) -> list[dict[str, Any]]

Query the LaminHub database write log, ordered by id.

Every INSERT, UPDATE and DELETE on the instance database is logged with table_name, sqlrecord_id, event_type, branch_id and data. For updates, data holds the previous values of the changed fields; for deletes the full previous row; for inserts it is null.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def query_dbwrites(
    self,
    filter: FilterLike | None = None,
    *,
    after_id: int | None = None,
    limit: int = MAX_PAGE_SIZE,
    descending: bool = False,
) -> list[dict[str, Any]]:
    """
    Query the LaminHub database write log, ordered by id.

    Every ``INSERT``, ``UPDATE`` and ``DELETE`` on the instance database is logged with
    ``table_name``, ``sqlrecord_id``, ``event_type``, ``branch_id`` and ``data``. For updates,
    ``data`` holds the *previous* values of the changed fields; for deletes the full previous
    row; for inserts it is ``null``.
    """
    return self.query_records(
        DBWRITE_REGISTRY,
        self._dbwrite_filter(filter, after_id),
        order_by=[{"field": "id", "descending": descending}],
        limit=limit,
    )

get_latest_dbwrite_id

get_latest_dbwrite_id() -> int

Return the id of the most recent database write (0 if there is none).

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_latest_dbwrite_id(self) -> int:
    """Return the id of the most recent database write (``0`` if there is none)."""
    rows = self.query_dbwrites(limit=1, descending=True)
    return int(rows[0]["id"]) if rows else 0

get_branch

get_branch(branch: str | int) -> dict[str, Any] | None

Return a branch record by name or id, or None if it doesn't exist.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_branch(self, branch: str | int) -> dict[str, Any] | None:
    """Return a branch record by name or id, or ``None`` if it doesn't exist."""
    rows = self.query_records("core.branch", self._branch_filter(branch), limit=1)
    return rows[0] if rows else None

get_users

get_users(ids: Iterable[int]) -> dict[int, dict[str, Any]]

Return {id: user} for the given user ids.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def get_users(self, ids: Iterable[int]) -> dict[int, dict[str, Any]]:
    """Return ``{id: user}`` for the given user ids."""
    return self.get_records_by_ids("core.user", ids)

insert_records

insert_records(
    registry: str | Registry, records: Sequence[Mapping[str, Any]]
) -> list[dict[str, Any]]

Insert records into a registry and return the created rows.

Needs write access to the instance. Fields are column names, e.g. {"name": "treated"} or {"type_id": 3}. Inserts are not retried after errors that may have reached LaminHub, so a failed request never creates a record twice.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def insert_records(
    self, registry: str | Registry, records: Sequence[Mapping[str, Any]]
) -> list[dict[str, Any]]:
    """
    Insert records into a registry and return the created rows.

    Needs write access to the instance. Fields are column names, e.g. ``{"name": "treated"}`` or
    ``{"type_id": 3}``. Inserts are not retried after errors that may have reached LaminHub, so a
    failed request never creates a record twice.
    """
    reg = self.get_registry(registry)
    url = _registry_url(self.get_instance(), reg)
    return _written_rows(self._send("PUT", url, json=list(records), idempotent=False), reg)

update_record

update_record(
    registry: str | Registry, uid: str, values: Mapping[str, Any]
) -> dict[str, Any] | None

Update fields of the record with uid and return the updated row (if LaminHub returns it).

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def update_record(
    self, registry: str | Registry, uid: str, values: Mapping[str, Any]
) -> dict[str, Any] | None:
    """Update fields of the record with ``uid`` and return the updated row (if LaminHub returns it)."""
    reg = self.get_registry(registry)
    url = f"{_registry_url(self.get_instance(), reg)}/{uid}"
    rows = _written_rows(self._send("PATCH", url, json=dict(values)), reg)
    return rows[0] if rows else None

test_connection

test_connection() -> tuple[bool, str]

Test the connection by resolving the instance and reading its database write log.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
def test_connection(self) -> tuple[bool, str]:
    """Test the connection by resolving the instance and reading its database write log."""
    try:
        instance = self.get_instance()
        self.query_dbwrites(limit=1, descending=True)
    except Exception as err:
        return False, str(err)
    finally:
        self.close()
    return True, f"Connected to LaminDB instance {instance.slug} ({instance.api_url})."

aget_instance async

aget_instance() -> LaminDBInstance

Async version of get_instance.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aget_instance(self) -> LaminDBInstance:
    """Async version of [`get_instance`][]."""
    if self._instance is None:
        config = await self._aget_config()
        settings = await self._asend("GET", self._settings_url(config))
        self._instance = self._instance_from_settings(config, settings)
    return self._instance

aget_schema async

aget_schema() -> dict[str, Any]

Async version of get_schema.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aget_schema(self) -> dict[str, Any]:
    """Async version of [`get_schema`][]."""
    if self._schema is None:
        instance = await self.aget_instance()
        self._schema = await self._asend("GET", f"{instance.api_url}/instances/{instance.id}/schema")
    return self._schema

aget_registry async

aget_registry(registry: str | Registry) -> Registry

Async version of get_registry.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aget_registry(self, registry: str | Registry) -> Registry:
    """Async version of [`get_registry`][]."""
    if isinstance(registry, Registry):
        return registry
    if registry.lower().startswith("hubmodule."):
        return resolve_registry({}, registry)
    return resolve_registry(await self.aget_schema(), registry)

aquery_records async

aquery_records(
    registry: str | Registry,
    filter: FilterLike | None = None,
    *,
    select: Sequence[str] | None = None,
    order_by: Sequence[str | Mapping[str, Any]] | None = None,
    limit: int = 50,
    offset: int = 0,
    include_foreign_keys: bool = True,
    search: str | None = None,
    branch_ids: Sequence[int] | None = None,
) -> list[dict[str, Any]]

Async version of query_records.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aquery_records(
    self,
    registry: str | Registry,
    filter: FilterLike | None = None,
    *,
    select: Sequence[str] | None = None,
    order_by: Sequence[str | Mapping[str, Any]] | None = None,
    limit: int = 50,
    offset: int = 0,
    include_foreign_keys: bool = True,
    search: str | None = None,
    branch_ids: Sequence[int] | None = None,
) -> list[dict[str, Any]]:
    """Async version of [`query_records`][]."""
    reg = await self.aget_registry(registry)
    instance = await self.aget_instance()
    results: list[dict[str, Any]] = []
    while len(results) < limit:
        page_size = min(MAX_PAGE_SIZE, limit - len(results))
        url, params, body = self._records_request(
            instance,
            reg,
            filter=filter,
            select=select,
            order_by=order_by,
            limit=page_size,
            offset=offset + len(results),
            include_foreign_keys=include_foreign_keys,
            search=search,
            branch_ids=branch_ids,
        )
        page = self._check_page(await self._asend("POST", url, params=params, json=body), reg)
        results.extend(page)
        if len(page) < page_size:
            break
    return results

aget_records_by_ids async

aget_records_by_ids(
    registry: str | Registry, ids: Iterable[int], filter: FilterLike | None = None
) -> dict[int, dict[str, Any]]

Async version of get_records_by_ids.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aget_records_by_ids(
    self, registry: str | Registry, ids: Iterable[int], filter: FilterLike | None = None
) -> dict[int, dict[str, Any]]:
    """Async version of [`get_records_by_ids`][]."""
    records: dict[int, dict[str, Any]] = {}
    for chunk in chunk_ids(ids):
        combined = combine_filters({"id": {"in": chunk}}, filter)
        for record in await self.aquery_records(registry, combined, limit=len(chunk)):
            records[record["id"]] = record
    return records

aquery_dbwrites async

aquery_dbwrites(
    filter: FilterLike | None = None,
    *,
    after_id: int | None = None,
    limit: int = MAX_PAGE_SIZE,
    descending: bool = False,
) -> list[dict[str, Any]]

Async version of query_dbwrites.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aquery_dbwrites(
    self,
    filter: FilterLike | None = None,
    *,
    after_id: int | None = None,
    limit: int = MAX_PAGE_SIZE,
    descending: bool = False,
) -> list[dict[str, Any]]:
    """Async version of [`query_dbwrites`][]."""
    return await self.aquery_records(
        DBWRITE_REGISTRY,
        self._dbwrite_filter(filter, after_id),
        order_by=[{"field": "id", "descending": descending}],
        limit=limit,
    )

aget_latest_dbwrite_id async

aget_latest_dbwrite_id() -> int

Async version of get_latest_dbwrite_id.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aget_latest_dbwrite_id(self) -> int:
    """Async version of [`get_latest_dbwrite_id`][]."""
    rows = await self.aquery_dbwrites(limit=1, descending=True)
    return int(rows[0]["id"]) if rows else 0

aget_branch async

aget_branch(branch: str | int) -> dict[str, Any] | None

Async version of get_branch.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aget_branch(self, branch: str | int) -> dict[str, Any] | None:
    """Async version of [`get_branch`][]."""
    rows = await self.aquery_records("core.branch", self._branch_filter(branch), limit=1)
    return rows[0] if rows else None

aget_users async

aget_users(ids: Iterable[int]) -> dict[int, dict[str, Any]]

Async version of get_users.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aget_users(self, ids: Iterable[int]) -> dict[int, dict[str, Any]]:
    """Async version of [`get_users`][]."""
    return await self.aget_records_by_ids("core.user", ids)

ainsert_records async

ainsert_records(
    registry: str | Registry, records: Sequence[Mapping[str, Any]]
) -> list[dict[str, Any]]

Async version of insert_records.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def ainsert_records(
    self, registry: str | Registry, records: Sequence[Mapping[str, Any]]
) -> list[dict[str, Any]]:
    """Async version of [`insert_records`][]."""
    reg = await self.aget_registry(registry)
    url = _registry_url(await self.aget_instance(), reg)
    return _written_rows(await self._asend("PUT", url, json=list(records), idempotent=False), reg)

aupdate_record async

aupdate_record(
    registry: str | Registry, uid: str, values: Mapping[str, Any]
) -> dict[str, Any] | None

Async version of update_record.

Source code in src/airflow/providers/lamindb/hooks/lamindb.py
async def aupdate_record(
    self, registry: str | Registry, uid: str, values: Mapping[str, Any]
) -> dict[str, Any] | None:
    """Async version of [`update_record`][]."""
    reg = await self.aget_registry(registry)
    url = f"{_registry_url(await self.aget_instance(), reg)}/{uid}"
    rows = _written_rows(await self._asend("PATCH", url, json=dict(values)), reg)
    return rows[0] if rows else None

LaminDBInstance dataclass

LaminDBInstance(
    owner: str,
    name: str,
    id: str,
    api_url: str,
    lnid: str | None = None,
    schema_str: str | None = None,
    public: bool | None = None,
    lamindb_version: str | None = None,
)

A LaminDB instance registered on LaminHub.

Registry dataclass

Registry(module: str, model: str, table_name: str)

A LaminDB registry (a Django model), addressed by schema module and model name.

airflow.providers.lamindb.utils.filters

Build, validate and evaluate LaminHub REST filters.

Filters select records by their fields. Build them with F and the field enums, or write the JSON form of the LaminHub REST API directly. These are equivalent:

F(ArtifactField.KEY).startswith("raw/") & (F(ArtifactField.SIZE) > 1_000_000)
{"and": [{"key": {"startswith": "raw/"}}, {"size": {"gt": 1000000}}]}

F

F(*path: str)

A field to filter on, e.g. F(ArtifactField.KEY), F("key") or F("created_by.handle").

Compare it with a value to get a Condition, using Python's comparison operators (==, !=, >, >=, <, <=) or the methods of this class. Combine conditions with & (and) and | (or); as & and | bind more tightly than comparisons, wrap comparisons in parentheses:

(F(ArtifactField.SUFFIX) == ".parquet") & (F(ArtifactField.SIZE) > 1_000_000)
F(ArtifactField.KEY).startswith("raw/") | F(ArtifactField.KIND).is_in([ArtifactKind.DATASET])

Pass several fields to follow relations: F(ArtifactField.CREATED_BY, UserField.HANDLE) is the path created_by.handle. Index JSON fields with keys: F(RunField.PARAMS)["learning_rate"].

Parameters:

  • path (str, default: () ) –

    Field enum members or field names, e.g. ArtifactField.KEY or "key".

Source code in src/airflow/providers/lamindb/utils/filters.py
def __init__(self, *path: str) -> None:
    if not path:
        raise ValueError("F() needs a field, e.g. F(ArtifactField.KEY) or F('key')")
    previous: str | None = None
    for part in path:
        if not isinstance(part, str) or not part:
            raise TypeError(f"Fields must be field enum members or non-empty strings, got {part!r}")
        if isinstance(previous, RegistryField):
            _check_relation_step(previous, part)
        previous = part
    self._path = ".".join(plain_value(part) for part in path)
    self._relation = previous if isinstance(previous, RegistryField) and previous.related else None

path property

path: str

The field path in the LaminHub REST format, e.g. created_by.handle.

op

op(operator: FilterOperator | str, value: Any) -> Condition

Compare with any FilterOperator, e.g. F("key").op(FilterOperator.EQ, "a.csv").

Source code in src/airflow/providers/lamindb/utils/filters.py
def op(self, operator: FilterOperator | str, value: Any) -> Condition:
    """Compare with any [`FilterOperator`][], e.g. ``F("key").op(FilterOperator.EQ, "a.csv")``."""
    return Condition(self, operator, value)

eq

eq(value: Any) -> Condition

Equal to value (==); None selects null values.

Source code in src/airflow/providers/lamindb/utils/filters.py
def eq(self, value: Any) -> Condition:
    """Equal to ``value`` (``==``); ``None`` selects ``null`` values."""
    return self.is_null() if value is None else Condition(self, FilterOperator.EQ, value)

ne

ne(value: Any) -> Condition

Distinct from value, including null values (!=); None selects non-null values.

Source code in src/airflow/providers/lamindb/utils/filters.py
def ne(self, value: Any) -> Condition:
    """Distinct from ``value``, including ``null`` values (``!=``); ``None`` selects non-null values."""
    return self.is_not_null() if value is None else Condition(self, FilterOperator.NE, value)

gt

gt(value: str | float | date) -> Condition

Greater than value (>).

Source code in src/airflow/providers/lamindb/utils/filters.py
def gt(self, value: str | float | datetime.date) -> Condition:
    """Greater than ``value`` (``>``)."""
    return Condition(self, FilterOperator.GT, value)

gte

gte(value: str | float | date) -> Condition

Greater than or equal to value (>=).

Source code in src/airflow/providers/lamindb/utils/filters.py
def gte(self, value: str | float | datetime.date) -> Condition:
    """Greater than or equal to ``value`` (``>=``)."""
    return Condition(self, FilterOperator.GTE, value)

lt

lt(value: str | float | date) -> Condition

Less than value (<).

Source code in src/airflow/providers/lamindb/utils/filters.py
def lt(self, value: str | float | datetime.date) -> Condition:
    """Less than ``value`` (``<``)."""
    return Condition(self, FilterOperator.LT, value)

lte

lte(value: str | float | date) -> Condition

Less than or equal to value (<=).

Source code in src/airflow/providers/lamindb/utils/filters.py
def lte(self, value: str | float | datetime.date) -> Condition:
    """Less than or equal to ``value`` (``<=``)."""
    return Condition(self, FilterOperator.LTE, value)

is_in

is_in(values: Iterable[Any]) -> Condition

Equal to any of values; an empty list matches nothing.

Source code in src/airflow/providers/lamindb/utils/filters.py
def is_in(self, values: Iterable[Any]) -> Condition:
    """Equal to any of ``values``; an empty list matches nothing."""
    return Condition(self, FilterOperator.IN, _as_list(values))

not_in

not_in(values: Iterable[Any]) -> Condition

Equal to none of values.

Source code in src/airflow/providers/lamindb/utils/filters.py
def not_in(self, values: Iterable[Any]) -> Condition:
    """Equal to none of ``values``."""
    return Condition(self, FilterOperator.NOT_IN, _as_list(values))

is_null

is_null() -> Condition

The field is null.

Source code in src/airflow/providers/lamindb/utils/filters.py
def is_null(self) -> Condition:
    """The field is ``null``."""
    return Condition(self, FilterOperator.IS_NULL, True)

is_not_null

is_not_null() -> Condition

The field is not null.

Source code in src/airflow/providers/lamindb/utils/filters.py
def is_not_null(self) -> Condition:
    """The field is not ``null``."""
    return Condition(self, FilterOperator.IS_NULL, False)

startswith

startswith(prefix: str) -> Condition

The string starts with prefix (case-sensitive).

Source code in src/airflow/providers/lamindb/utils/filters.py
def startswith(self, prefix: str) -> Condition:
    """The string starts with ``prefix`` (case-sensitive)."""
    return Condition(self, FilterOperator.STARTSWITH, prefix)

endswith

endswith(suffix: str) -> Condition

The string ends with suffix (case-sensitive).

Source code in src/airflow/providers/lamindb/utils/filters.py
def endswith(self, suffix: str) -> Condition:
    """The string ends with ``suffix`` (case-sensitive)."""
    return Condition(self, FilterOperator.ENDSWITH, suffix)

contains

contains(value: str | float | bool) -> Condition

The string contains value (case-sensitive), or the JSON array has the element value.

Source code in src/airflow/providers/lamindb/utils/filters.py
def contains(self, value: str | float | bool) -> Condition:
    """The string contains ``value`` (case-sensitive), or the JSON array has the element ``value``."""
    return Condition(self, FilterOperator.CONTAINS, value)

count

count() -> Count

The number of related records, e.g. F(TransformField.RUNS).count() >= 2.

Source code in src/airflow/providers/lamindb/utils/filters.py
def count(self) -> Count:
    """The number of related records, e.g. ``F(TransformField.RUNS).count() >= 2``."""
    return Count(self)

Count

Count(field: F)

The number of related records of a relation, see F.count.

Source code in src/airflow/providers/lamindb/utils/filters.py
def __init__(self, field: F) -> None:
    field._count_path()  # fail early for fields that can't be counted
    self._field = field

eq

eq(n: int) -> Condition

Exactly n related records (==).

Source code in src/airflow/providers/lamindb/utils/filters.py
def eq(self, n: int) -> Condition:
    """Exactly ``n`` related records (``==``)."""
    return Condition(self._field, FilterOperator.COUNT_EQ, n)

ne

ne(n: int) -> Condition

Not exactly n related records (!=).

Source code in src/airflow/providers/lamindb/utils/filters.py
def ne(self, n: int) -> Condition:
    """Not exactly ``n`` related records (``!=``)."""
    return Condition(self._field, FilterOperator.COUNT_NE, n)

gt

gt(n: int) -> Condition

More than n related records (>).

Source code in src/airflow/providers/lamindb/utils/filters.py
def gt(self, n: int) -> Condition:
    """More than ``n`` related records (``>``)."""
    return Condition(self._field, FilterOperator.COUNT_GT, n)

gte

gte(n: int) -> Condition

At least n related records (>=).

Source code in src/airflow/providers/lamindb/utils/filters.py
def gte(self, n: int) -> Condition:
    """At least ``n`` related records (``>=``)."""
    return Condition(self._field, FilterOperator.COUNT_GTE, n)

lt

lt(n: int) -> Condition

Fewer than n related records (<).

Source code in src/airflow/providers/lamindb/utils/filters.py
def lt(self, n: int) -> Condition:
    """Fewer than ``n`` related records (``<``)."""
    return Condition(self._field, FilterOperator.COUNT_LT, n)

lte

lte(n: int) -> Condition

At most n related records (<=).

Source code in src/airflow/providers/lamindb/utils/filters.py
def lte(self, n: int) -> Condition:
    """At most ``n`` related records (``<=``)."""
    return Condition(self._field, FilterOperator.COUNT_LTE, n)

FilterExpression

Base class of filters built in Python: Condition, And and Or.

Combine filters with & (and) and | (or); the other operand may also be a LaminHub REST filter dict. to_dict returns the JSON form that the LaminHub REST API expects.

to_dict

to_dict() -> dict[str, Any]

Return the filter in the JSON form of the LaminHub REST API.

Source code in src/airflow/providers/lamindb/utils/filters.py
def to_dict(self) -> dict[str, Any]:
    """Return the filter in the JSON form of the LaminHub REST API."""
    raise NotImplementedError

from_dict staticmethod

from_dict(node: Mapping[str, Any]) -> FilterExpression

Parse and validate a LaminHub REST filter, e.g. {"key": {"eq": "raw/a.csv"}}.

Source code in src/airflow/providers/lamindb/utils/filters.py
@staticmethod
def from_dict(node: Mapping[str, Any]) -> FilterExpression:
    """Parse and validate a LaminHub REST filter, e.g. ``{"key": {"eq": "raw/a.csv"}}``."""
    if not isinstance(node, Mapping) or len(node) != 1:
        raise ValueError(
            f"Filters must have exactly one key, a field or 'and'/'or', got {node!r}; "
            "combine conditions with {'and': [...]}"
        )
    ((key, value),) = node.items()
    if plain_value(key) in ("and", "or"):
        group = plain_value(key)
        if not isinstance(value, (list, tuple)) or not value:
            raise ValueError(f"{group!r} expects a non-empty list of filters, got {value!r}")
        return (And if group == "and" else Or)(*value)
    if not isinstance(value, Mapping) or len(value) != 1:
        raise ValueError(
            f"The condition on {key!r} must have exactly one operator, e.g. {{'eq': ...}}, got {value!r}"
        )
    ((operator, operand),) = value.items()
    return Condition(key, operator, operand)

Condition

Condition(field: F | str, operator: FilterOperator | str, value: Any)

Bases: FilterExpression

A condition on a field, e.g. Condition(ArtifactField.KEY, FilterOperator.STARTSWITH, "raw/").

Comparing an F creates conditions too, e.g. F(ArtifactField.KEY).startswith("raw/").

Parameters:

  • field (F | str) –

    The field, as an F, a field enum member or a field name.

  • operator (FilterOperator | str) –

    A FilterOperator or its name, e.g. "startswith".

  • value (Any) –

    The value to compare with; enum members, dates, tuples and sets are converted to their JSON form.

Source code in src/airflow/providers/lamindb/utils/filters.py
def __init__(self, field: F | str, operator: FilterOperator | str, value: Any) -> None:
    if not isinstance(field, F):
        field = F(field)
    try:
        operator = FilterOperator(operator)
    except ValueError:
        raise ValueError(
            f"Unknown filter operator {plain_value(operator)!r} on {field.path!r}; expected one of "
            f"{', '.join(op.value for op in FilterOperator)}"
        ) from None
    if operator.is_count:
        path = field._count_path()
    elif field._relation is not None:
        raise ValueError(_relation_hint(field._relation))
    else:
        path = field.path
    self.path = path
    self.operator = operator
    self.value = _check_value(operator, value, path)

And

And(*filters: FilterLike)

Bases: _Group

All filters match, e.g. And(F("suffix") == ".csv", F("size") > 0); like &.

Source code in src/airflow/providers/lamindb/utils/filters.py
def __init__(self, *filters: FilterLike) -> None:
    if not filters:
        raise ValueError(f"{type(self).__name__}() needs at least one filter")
    self.filters: tuple[FilterExpression, ...] = tuple(_as_expression(f) for f in filters)

Or

Or(*filters: FilterLike)

Bases: _Group

At least one filter matches, e.g. Or(F("suffix") == ".csv", F("suffix") == ".tsv"); like |.

Source code in src/airflow/providers/lamindb/utils/filters.py
def __init__(self, *filters: FilterLike) -> None:
    if not filters:
        raise ValueError(f"{type(self).__name__}() needs at least one filter")
    self.filters: tuple[FilterExpression, ...] = tuple(_as_expression(f) for f in filters)

airflow.providers.lamindb.utils.enums

Enums for building LaminHub REST filters: registries, filter operators, registry fields and values.

The field enums reflect the core registries of LaminDB 2.11. Use them with F, for example F(ArtifactField.KEY) == "raw/a.csv". Plain strings work for every field, including fields of other schema modules such as bionty.

LaminDBRegistry

Bases: _StrEnum

Registries (module.model) to pass as registry to sensors, triggers and the hook.

ARTIFACT class-attribute instance-attribute

ARTIFACT = 'core.artifact'

COLLECTION class-attribute instance-attribute

COLLECTION = 'core.collection'

RUN class-attribute instance-attribute

RUN = 'core.run'

TRANSFORM class-attribute instance-attribute

TRANSFORM = 'core.transform'

RECORD class-attribute instance-attribute

RECORD = 'core.record'

ULABEL class-attribute instance-attribute

ULABEL = 'core.ulabel'

FEATURE class-attribute instance-attribute

FEATURE = 'core.feature'

SCHEMA class-attribute instance-attribute

SCHEMA = 'core.schema'

PROJECT class-attribute instance-attribute

PROJECT = 'core.project'

REFERENCE class-attribute instance-attribute

REFERENCE = 'core.reference'

STORAGE class-attribute instance-attribute

STORAGE = 'core.storage'

BRANCH class-attribute instance-attribute

BRANCH = 'core.branch'

SPACE class-attribute instance-attribute

SPACE = 'core.space'

USER class-attribute instance-attribute

USER = 'core.user'

BIONTY_CELL_LINE class-attribute instance-attribute

BIONTY_CELL_LINE = 'bionty.cellline'

BIONTY_CELL_MARKER class-attribute instance-attribute

BIONTY_CELL_MARKER = 'bionty.cellmarker'

BIONTY_CELL_TYPE class-attribute instance-attribute

BIONTY_CELL_TYPE = 'bionty.celltype'

BIONTY_DEVELOPMENTAL_STAGE class-attribute instance-attribute

BIONTY_DEVELOPMENTAL_STAGE = 'bionty.developmentalstage'

BIONTY_DISEASE class-attribute instance-attribute

BIONTY_DISEASE = 'bionty.disease'

BIONTY_ETHNICITY class-attribute instance-attribute

BIONTY_ETHNICITY = 'bionty.ethnicity'

BIONTY_EXPERIMENTAL_FACTOR class-attribute instance-attribute

BIONTY_EXPERIMENTAL_FACTOR = 'bionty.experimentalfactor'

BIONTY_GENE class-attribute instance-attribute

BIONTY_GENE = 'bionty.gene'

BIONTY_ORGANISM class-attribute instance-attribute

BIONTY_ORGANISM = 'bionty.organism'

BIONTY_PATHWAY class-attribute instance-attribute

BIONTY_PATHWAY = 'bionty.pathway'

BIONTY_PHENOTYPE class-attribute instance-attribute

BIONTY_PHENOTYPE = 'bionty.phenotype'

BIONTY_PROTEIN class-attribute instance-attribute

BIONTY_PROTEIN = 'bionty.protein'

BIONTY_SOURCE class-attribute instance-attribute

BIONTY_SOURCE = 'bionty.source'

BIONTY_TISSUE class-attribute instance-attribute

BIONTY_TISSUE = 'bionty.tissue'

FilterOperator

Bases: _StrEnum

Operators of LaminHub REST filters, see https://docs.lamin.ai/rest.

EQ class-attribute instance-attribute

EQ = 'eq'

Equal to the value.

NE class-attribute instance-attribute

NE = 'ne'

Distinct from the value, including null on SQL columns.

GT class-attribute instance-attribute

GT = 'gt'

Greater than the value (a string or number).

GTE class-attribute instance-attribute

GTE = 'gte'

Greater than or equal to the value (a string or number).

LT class-attribute instance-attribute

LT = 'lt'

Less than the value (a string or number).

LTE class-attribute instance-attribute

LTE = 'lte'

Less than or equal to the value (a string or number).

IN class-attribute instance-attribute

IN = 'in'

Equal to any of the listed values; an empty list matches nothing.

NOT_IN class-attribute instance-attribute

NOT_IN = 'notin'

Equal to none of the listed values.

IS_NULL class-attribute instance-attribute

IS_NULL = 'isnull'

True selects null values, False selects non-null values.

STARTSWITH class-attribute instance-attribute

STARTSWITH = 'startswith'

Case-sensitive prefix.

ENDSWITH class-attribute instance-attribute

ENDSWITH = 'endswith'

Case-sensitive suffix.

CONTAINS class-attribute instance-attribute

CONTAINS = 'contains'

Case-sensitive substring of strings, or element of JSON arrays.

COUNT_EQ class-attribute instance-attribute

COUNT_EQ = 'count_eq'

Number of related records equals the value.

COUNT_NE class-attribute instance-attribute

COUNT_NE = 'count_ne'

Number of related records differs from the value.

COUNT_GT class-attribute instance-attribute

COUNT_GT = 'count_gt'

Number of related records is greater than the value.

COUNT_GTE class-attribute instance-attribute

COUNT_GTE = 'count_gte'

Number of related records is at least the value.

COUNT_LT class-attribute instance-attribute

COUNT_LT = 'count_lt'

Number of related records is less than the value.

COUNT_LTE class-attribute instance-attribute

COUNT_LTE = 'count_lte'

Number of related records is at most the value.

is_count property

is_count: bool

Whether the operator compares the number of related records.

ArtifactKind

Bases: _StrEnum

Values of ArtifactField.KIND.

DATASET class-attribute instance-attribute

DATASET = 'dataset'

MODEL class-attribute instance-attribute

MODEL = 'model'

PLAN class-attribute instance-attribute

PLAN = 'plan'

LAMINDB_RUN class-attribute instance-attribute

LAMINDB_RUN = '__lamindb_run__'

Created by LaminDB for runs (logs, reports, environments).

LAMINDB_CONFIG class-attribute instance-attribute

LAMINDB_CONFIG = '__lamindb_config__'

Created by LaminDB for configurations.

TransformKind

Bases: _StrEnum

Values of TransformField.KIND.

PIPELINE class-attribute instance-attribute

PIPELINE = 'pipeline'

NOTEBOOK class-attribute instance-attribute

NOTEBOOK = 'notebook'

SCRIPT class-attribute instance-attribute

SCRIPT = 'script'

FUNCTION class-attribute instance-attribute

FUNCTION = 'function'

RunStatus

Bases: IntEnum

Run statuses, as the codes stored in RunField.STATUS_CODE.

SCHEDULED class-attribute instance-attribute

SCHEDULED = -3

RESTARTED class-attribute instance-attribute

RESTARTED = -2

STARTED class-attribute instance-attribute

STARTED = -1

COMPLETED class-attribute instance-attribute

COMPLETED = 0

ERRORED class-attribute instance-attribute

ERRORED = 1

ABORTED class-attribute instance-attribute

ABORTED = 2

RegistryField

Bases: _StrEnum

Base class of the registry field enums.

Members that are relations know the registry they point to (related), so that F can follow them, for example F(ArtifactField.CREATED_BY, UserField.HANDLE). Foreign keys (..._ID members) hold the id of the related record and can be compared directly.

related instance-attribute

related: LaminDBRegistry | None

ArtifactField

Bases: RegistryField

Fields of core.artifact (LaminDBRegistry.ARTIFACT).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

EXTRA_DATA class-attribute instance-attribute

EXTRA_DATA = 'extra_data'

HASH class-attribute instance-attribute

HASH = 'hash'

IS_LATEST class-attribute instance-attribute

IS_LATEST = 'is_latest'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

KEY class-attribute instance-attribute

KEY = 'key'

KIND class-attribute instance-attribute

KIND = 'kind'

N_FILES class-attribute instance-attribute

N_FILES = 'n_files'

N_OBSERVATIONS class-attribute instance-attribute

N_OBSERVATIONS = 'n_observations'

OTYPE class-attribute instance-attribute

OTYPE = 'otype'

SIZE class-attribute instance-attribute

SIZE = 'size'

SUFFIX class-attribute instance-attribute

SUFFIX = 'suffix'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

VERSION_TAG class-attribute instance-attribute

VERSION_TAG = 'version_tag'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SCHEMA_ID class-attribute instance-attribute

SCHEMA_ID = 'schema_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

STORAGE_ID class-attribute instance-attribute

STORAGE_ID = 'storage_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SCHEMA class-attribute instance-attribute

SCHEMA = ('schema', LaminDBRegistry.SCHEMA)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

STORAGE class-attribute instance-attribute

STORAGE = ('storage', LaminDBRegistry.STORAGE)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

COLLECTIONS class-attribute instance-attribute

COLLECTIONS = ('collections', LaminDBRegistry.COLLECTION)

INPUT_OF_RUNS class-attribute instance-attribute

INPUT_OF_RUNS = ('input_of_runs', LaminDBRegistry.RUN)

LINKED_BY_ARTIFACTS class-attribute instance-attribute

LINKED_BY_ARTIFACTS = ('linked_by_artifacts', LaminDBRegistry.ARTIFACT)

LINKED_BY_RUNS class-attribute instance-attribute

LINKED_BY_RUNS = ('linked_by_runs', LaminDBRegistry.RUN)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

RECORDS class-attribute instance-attribute

RECORDS = ('records', LaminDBRegistry.RECORD)

RECREATING_RUNS class-attribute instance-attribute

RECREATING_RUNS = ('recreating_runs', LaminDBRegistry.RUN)

REFERENCES class-attribute instance-attribute

REFERENCES = ('references', LaminDBRegistry.REFERENCE)

RUNS class-attribute instance-attribute

RUNS = ('runs', LaminDBRegistry.RUN)

SCHEMAS class-attribute instance-attribute

SCHEMAS = ('schemas', LaminDBRegistry.SCHEMA)

ULABELS class-attribute instance-attribute

ULABELS = ('ulabels', LaminDBRegistry.ULABEL)

USERS class-attribute instance-attribute

USERS = ('users', LaminDBRegistry.USER)

CollectionField

Bases: RegistryField

Fields of core.collection (LaminDBRegistry.COLLECTION).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

HASH class-attribute instance-attribute

HASH = 'hash'

IS_LATEST class-attribute instance-attribute

IS_LATEST = 'is_latest'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

KEY class-attribute instance-attribute

KEY = 'key'

REFERENCE class-attribute instance-attribute

REFERENCE = 'reference'

REFERENCE_TYPE class-attribute instance-attribute

REFERENCE_TYPE = 'reference_type'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

VERSION_TAG class-attribute instance-attribute

VERSION_TAG = 'version_tag'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

META_ARTIFACT_ID class-attribute instance-attribute

META_ARTIFACT_ID = 'meta_artifact_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SCHEMA_ID class-attribute instance-attribute

SCHEMA_ID = 'schema_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

META_ARTIFACT class-attribute instance-attribute

META_ARTIFACT = ('meta_artifact', LaminDBRegistry.ARTIFACT)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SCHEMA class-attribute instance-attribute

SCHEMA = ('schema', LaminDBRegistry.SCHEMA)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

INPUT_OF_RUNS class-attribute instance-attribute

INPUT_OF_RUNS = ('input_of_runs', LaminDBRegistry.RUN)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

RECORDS class-attribute instance-attribute

RECORDS = ('records', LaminDBRegistry.RECORD)

RECREATING_RUNS class-attribute instance-attribute

RECREATING_RUNS = ('recreating_runs', LaminDBRegistry.RUN)

REFERENCES class-attribute instance-attribute

REFERENCES = ('references', LaminDBRegistry.REFERENCE)

ULABELS class-attribute instance-attribute

ULABELS = ('ulabels', LaminDBRegistry.ULABEL)

RunField

Bases: RegistryField

Fields of core.run (LaminDBRegistry.RUN).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CLI_ARGS class-attribute instance-attribute

CLI_ARGS = 'cli_args'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

ENTRYPOINT class-attribute instance-attribute

ENTRYPOINT = 'entrypoint'

EXTRA_DATA class-attribute instance-attribute

EXTRA_DATA = 'extra_data'

FINISHED_AT class-attribute instance-attribute

FINISHED_AT = 'finished_at'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

NAME class-attribute instance-attribute

NAME = 'name'

PARAMS class-attribute instance-attribute

PARAMS = 'params'

REFERENCE class-attribute instance-attribute

REFERENCE = 'reference'

REFERENCE_TYPE class-attribute instance-attribute

REFERENCE_TYPE = 'reference_type'

STARTED_AT class-attribute instance-attribute

STARTED_AT = 'started_at'

STATUS_CODE class-attribute instance-attribute

STATUS_CODE = '_status_code'

The run status as a code, compare it with RunStatus.

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

ENVIRONMENT_ID class-attribute instance-attribute

ENVIRONMENT_ID = 'environment_id'

INITIATED_BY_RUN_ID class-attribute instance-attribute

INITIATED_BY_RUN_ID = 'initiated_by_run_id'

PLAN_ID class-attribute instance-attribute

PLAN_ID = 'plan_id'

REPORT_ID class-attribute instance-attribute

REPORT_ID = 'report_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

TRANSFORM_ID class-attribute instance-attribute

TRANSFORM_ID = 'transform_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

ENVIRONMENT class-attribute instance-attribute

ENVIRONMENT = ('environment', LaminDBRegistry.ARTIFACT)

INITIATED_BY_RUN class-attribute instance-attribute

INITIATED_BY_RUN = ('initiated_by_run', LaminDBRegistry.RUN)

PLAN class-attribute instance-attribute

PLAN = ('plan', LaminDBRegistry.ARTIFACT)

REPORT class-attribute instance-attribute

REPORT = ('report', LaminDBRegistry.ARTIFACT)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

TRANSFORM class-attribute instance-attribute

TRANSFORM = ('transform', LaminDBRegistry.TRANSFORM)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

INPUT_ARTIFACTS class-attribute instance-attribute

INPUT_ARTIFACTS = ('input_artifacts', LaminDBRegistry.ARTIFACT)

INPUT_COLLECTIONS class-attribute instance-attribute

INPUT_COLLECTIONS = ('input_collections', LaminDBRegistry.COLLECTION)

INPUT_RECORDS class-attribute instance-attribute

INPUT_RECORDS = ('input_records', LaminDBRegistry.RECORD)

LINKED_ARTIFACTS class-attribute instance-attribute

LINKED_ARTIFACTS = ('linked_artifacts', LaminDBRegistry.ARTIFACT)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

OUTPUT_ARTIFACTS class-attribute instance-attribute

OUTPUT_ARTIFACTS = ('output_artifacts', LaminDBRegistry.ARTIFACT)

OUTPUT_COLLECTIONS class-attribute instance-attribute

OUTPUT_COLLECTIONS = ('output_collections', LaminDBRegistry.COLLECTION)

OUTPUT_RECORDS class-attribute instance-attribute

OUTPUT_RECORDS = ('output_records', LaminDBRegistry.RECORD)

OUTPUT_TRANSFORMS class-attribute instance-attribute

OUTPUT_TRANSFORMS = ('output_transforms', LaminDBRegistry.TRANSFORM)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

RECORDS class-attribute instance-attribute

RECORDS = ('records', LaminDBRegistry.RECORD)

RECREATED_ARTIFACTS class-attribute instance-attribute

RECREATED_ARTIFACTS = ('recreated_artifacts', LaminDBRegistry.ARTIFACT)

RECREATED_COLLECTIONS class-attribute instance-attribute

RECREATED_COLLECTIONS = ('recreated_collections', LaminDBRegistry.COLLECTION)

ULABELS class-attribute instance-attribute

ULABELS = ('ulabels', LaminDBRegistry.ULABEL)

TransformField

Bases: RegistryField

Fields of core.transform (LaminDBRegistry.TRANSFORM).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

HASH class-attribute instance-attribute

HASH = 'hash'

IS_LATEST class-attribute instance-attribute

IS_LATEST = 'is_latest'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

KEY class-attribute instance-attribute

KEY = 'key'

KIND class-attribute instance-attribute

KIND = 'kind'

REFERENCE class-attribute instance-attribute

REFERENCE = 'reference'

REFERENCE_TYPE class-attribute instance-attribute

REFERENCE_TYPE = 'reference_type'

SOURCE_CODE class-attribute instance-attribute

SOURCE_CODE = 'source_code'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

VERSION_TAG class-attribute instance-attribute

VERSION_TAG = 'version_tag'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

ENVIRONMENT_ID class-attribute instance-attribute

ENVIRONMENT_ID = 'environment_id'

PLAN_ID class-attribute instance-attribute

PLAN_ID = 'plan_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

ENVIRONMENT class-attribute instance-attribute

ENVIRONMENT = ('environment', LaminDBRegistry.ARTIFACT)

PLAN class-attribute instance-attribute

PLAN = ('plan', LaminDBRegistry.ARTIFACT)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

PREDECESSORS class-attribute instance-attribute

PREDECESSORS = ('predecessors', LaminDBRegistry.TRANSFORM)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

RECORDS class-attribute instance-attribute

RECORDS = ('records', LaminDBRegistry.RECORD)

REFERENCES class-attribute instance-attribute

REFERENCES = ('references', LaminDBRegistry.REFERENCE)

RUNS class-attribute instance-attribute

RUNS = ('runs', LaminDBRegistry.RUN)

SUCCESSORS class-attribute instance-attribute

SUCCESSORS = ('successors', LaminDBRegistry.TRANSFORM)

ULABELS class-attribute instance-attribute

ULABELS = ('ulabels', LaminDBRegistry.ULABEL)

RecordField

Bases: RegistryField

Fields of core.record (LaminDBRegistry.RECORD).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

EXTRA_DATA class-attribute instance-attribute

EXTRA_DATA = 'extra_data'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

IS_TYPE class-attribute instance-attribute

IS_TYPE = 'is_type'

NAME class-attribute instance-attribute

NAME = 'name'

REFERENCE class-attribute instance-attribute

REFERENCE = 'reference'

REFERENCE_TYPE class-attribute instance-attribute

REFERENCE_TYPE = 'reference_type'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SCHEMA_ID class-attribute instance-attribute

SCHEMA_ID = 'schema_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

TYPE_ID class-attribute instance-attribute

TYPE_ID = 'type_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SCHEMA class-attribute instance-attribute

SCHEMA = ('schema', LaminDBRegistry.SCHEMA)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

TYPE class-attribute instance-attribute

TYPE = ('type', LaminDBRegistry.RECORD)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

CHILDREN class-attribute instance-attribute

CHILDREN = ('children', LaminDBRegistry.RECORD)

COLLECTIONS class-attribute instance-attribute

COLLECTIONS = ('collections', LaminDBRegistry.COLLECTION)

INPUT_OF_RUNS class-attribute instance-attribute

INPUT_OF_RUNS = ('input_of_runs', LaminDBRegistry.RUN)

LINKED_ARTIFACTS class-attribute instance-attribute

LINKED_ARTIFACTS = ('linked_artifacts', LaminDBRegistry.ARTIFACT)

LINKED_COLLECTIONS class-attribute instance-attribute

LINKED_COLLECTIONS = ('linked_collections', LaminDBRegistry.COLLECTION)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

LINKED_PROJECTS class-attribute instance-attribute

LINKED_PROJECTS = ('linked_projects', LaminDBRegistry.PROJECT)

LINKED_RECORDS class-attribute instance-attribute

LINKED_RECORDS = ('linked_records', LaminDBRegistry.RECORD)

LINKED_REFERENCES class-attribute instance-attribute

LINKED_REFERENCES = ('linked_references', LaminDBRegistry.REFERENCE)

LINKED_RUNS class-attribute instance-attribute

LINKED_RUNS = ('linked_runs', LaminDBRegistry.RUN)

LINKED_TRANSFORMS class-attribute instance-attribute

LINKED_TRANSFORMS = ('linked_transforms', LaminDBRegistry.TRANSFORM)

LINKED_ULABELS class-attribute instance-attribute

LINKED_ULABELS = ('linked_ulabels', LaminDBRegistry.ULABEL)

LINKED_USERS class-attribute instance-attribute

LINKED_USERS = ('linked_users', LaminDBRegistry.USER)

PARENTS class-attribute instance-attribute

PARENTS = ('parents', LaminDBRegistry.RECORD)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

REFERENCES class-attribute instance-attribute

REFERENCES = ('references', LaminDBRegistry.REFERENCE)

RUNS class-attribute instance-attribute

RUNS = ('runs', LaminDBRegistry.RUN)

TRANSFORMS class-attribute instance-attribute

TRANSFORMS = ('transforms', LaminDBRegistry.TRANSFORM)

ULabelField

Bases: RegistryField

Fields of core.ulabel (LaminDBRegistry.ULABEL).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

IS_TYPE class-attribute instance-attribute

IS_TYPE = 'is_type'

NAME class-attribute instance-attribute

NAME = 'name'

REFERENCE class-attribute instance-attribute

REFERENCE = 'reference'

REFERENCE_TYPE class-attribute instance-attribute

REFERENCE_TYPE = 'reference_type'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

TYPE_ID class-attribute instance-attribute

TYPE_ID = 'type_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

TYPE class-attribute instance-attribute

TYPE = ('type', LaminDBRegistry.ULABEL)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

BRANCHES class-attribute instance-attribute

BRANCHES = ('branches', LaminDBRegistry.BRANCH)

CHILDREN class-attribute instance-attribute

CHILDREN = ('children', LaminDBRegistry.ULABEL)

COLLECTIONS class-attribute instance-attribute

COLLECTIONS = ('collections', LaminDBRegistry.COLLECTION)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

PARENTS class-attribute instance-attribute

PARENTS = ('parents', LaminDBRegistry.ULABEL)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

RUNS class-attribute instance-attribute

RUNS = ('runs', LaminDBRegistry.RUN)

TRANSFORMS class-attribute instance-attribute

TRANSFORMS = ('transforms', LaminDBRegistry.TRANSFORM)

FeatureField

Bases: RegistryField

Fields of core.feature (LaminDBRegistry.FEATURE).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

ARRAY_RANK class-attribute instance-attribute

ARRAY_RANK = 'array_rank'

ARRAY_SHAPE class-attribute instance-attribute

ARRAY_SHAPE = 'array_shape'

ARRAY_SIZE class-attribute instance-attribute

ARRAY_SIZE = 'array_size'

COERCE class-attribute instance-attribute

COERCE = 'coerce'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DEFAULT_VALUE class-attribute instance-attribute

DEFAULT_VALUE = 'default_value'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

IS_TYPE class-attribute instance-attribute

IS_TYPE = 'is_type'

NAME class-attribute instance-attribute

NAME = 'name'

NULLABLE class-attribute instance-attribute

NULLABLE = 'nullable'

SYNONYMS class-attribute instance-attribute

SYNONYMS = 'synonyms'

UNIT class-attribute instance-attribute

UNIT = 'unit'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

TYPE_ID class-attribute instance-attribute

TYPE_ID = 'type_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

TYPE class-attribute instance-attribute

TYPE = ('type', LaminDBRegistry.FEATURE)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

SCHEMAS class-attribute instance-attribute

SCHEMAS = ('schemas', LaminDBRegistry.SCHEMA)

SchemaField

Bases: RegistryField

Fields of core.schema (LaminDBRegistry.SCHEMA).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

COERCE class-attribute instance-attribute

COERCE = 'coerce'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

FLEXIBLE class-attribute instance-attribute

FLEXIBLE = 'flexible'

HASH class-attribute instance-attribute

HASH = 'hash'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

IS_TYPE class-attribute instance-attribute

IS_TYPE = 'is_type'

ITYPE class-attribute instance-attribute

ITYPE = 'itype'

MAXIMAL_SET class-attribute instance-attribute

MAXIMAL_SET = 'maximal_set'

MINIMAL_SET class-attribute instance-attribute

MINIMAL_SET = 'minimal_set'

N_MEMBERS class-attribute instance-attribute

N_MEMBERS = 'n_members'

NAME class-attribute instance-attribute

NAME = 'name'

ORDERED_SET class-attribute instance-attribute

ORDERED_SET = 'ordered_set'

OTYPE class-attribute instance-attribute

OTYPE = 'otype'

SUFFIX class-attribute instance-attribute

SUFFIX = 'suffix'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

TYPE_ID class-attribute instance-attribute

TYPE_ID = 'type_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

TYPE class-attribute instance-attribute

TYPE = ('type', LaminDBRegistry.SCHEMA)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

COMPONENTS class-attribute instance-attribute

COMPONENTS = ('components', LaminDBRegistry.SCHEMA)

COMPOSITES class-attribute instance-attribute

COMPOSITES = ('composites', LaminDBRegistry.SCHEMA)

FEATURES class-attribute instance-attribute

FEATURES = ('features', LaminDBRegistry.FEATURE)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

RECORDS class-attribute instance-attribute

RECORDS = ('records', LaminDBRegistry.RECORD)

VALIDATED_ARTIFACTS class-attribute instance-attribute

VALIDATED_ARTIFACTS = ('validated_artifacts', LaminDBRegistry.ARTIFACT)

VALIDATED_COLLECTIONS class-attribute instance-attribute

VALIDATED_COLLECTIONS = ('validated_collections', LaminDBRegistry.COLLECTION)

ProjectField

Bases: RegistryField

Fields of core.project (LaminDBRegistry.PROJECT).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

ABBR class-attribute instance-attribute

ABBR = 'abbr'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

END_DATE class-attribute instance-attribute

END_DATE = 'end_date'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

IS_TYPE class-attribute instance-attribute

IS_TYPE = 'is_type'

NAME class-attribute instance-attribute

NAME = 'name'

START_DATE class-attribute instance-attribute

START_DATE = 'start_date'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

URL class-attribute instance-attribute

URL = 'url'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

TYPE_ID class-attribute instance-attribute

TYPE_ID = 'type_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

TYPE class-attribute instance-attribute

TYPE = ('type', LaminDBRegistry.PROJECT)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

BRANCHES class-attribute instance-attribute

BRANCHES = ('branches', LaminDBRegistry.BRANCH)

CHILDREN class-attribute instance-attribute

CHILDREN = ('children', LaminDBRegistry.PROJECT)

COLLECTIONS class-attribute instance-attribute

COLLECTIONS = ('collections', LaminDBRegistry.COLLECTION)

FEATURES class-attribute instance-attribute

FEATURES = ('features', LaminDBRegistry.FEATURE)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

PARENTS class-attribute instance-attribute

PARENTS = ('parents', LaminDBRegistry.PROJECT)

PREDECESSORS class-attribute instance-attribute

PREDECESSORS = ('predecessors', LaminDBRegistry.PROJECT)

RECORDS class-attribute instance-attribute

RECORDS = ('records', LaminDBRegistry.RECORD)

REFERENCES class-attribute instance-attribute

REFERENCES = ('references', LaminDBRegistry.REFERENCE)

RUNS class-attribute instance-attribute

RUNS = ('runs', LaminDBRegistry.RUN)

SCHEMAS class-attribute instance-attribute

SCHEMAS = ('schemas', LaminDBRegistry.SCHEMA)

SUCCESSORS class-attribute instance-attribute

SUCCESSORS = ('successors', LaminDBRegistry.PROJECT)

TRANSFORMS class-attribute instance-attribute

TRANSFORMS = ('transforms', LaminDBRegistry.TRANSFORM)

ULABELS class-attribute instance-attribute

ULABELS = ('ulabels', LaminDBRegistry.ULABEL)

USERS class-attribute instance-attribute

USERS = ('users', LaminDBRegistry.USER)

ReferenceField

Bases: RegistryField

Fields of core.reference (LaminDBRegistry.REFERENCE).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

ABBR class-attribute instance-attribute

ABBR = 'abbr'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DATE class-attribute instance-attribute

DATE = 'date'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

DOI class-attribute instance-attribute

DOI = 'doi'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

IS_TYPE class-attribute instance-attribute

IS_TYPE = 'is_type'

NAME class-attribute instance-attribute

NAME = 'name'

PUBMED_ID class-attribute instance-attribute

PUBMED_ID = 'pubmed_id'

TEXT class-attribute instance-attribute

TEXT = 'text'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

URL class-attribute instance-attribute

URL = 'url'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

TYPE_ID class-attribute instance-attribute

TYPE_ID = 'type_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

TYPE class-attribute instance-attribute

TYPE = ('type', LaminDBRegistry.REFERENCE)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

COLLECTIONS class-attribute instance-attribute

COLLECTIONS = ('collections', LaminDBRegistry.COLLECTION)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

RECORDS class-attribute instance-attribute

RECORDS = ('records', LaminDBRegistry.RECORD)

TRANSFORMS class-attribute instance-attribute

TRANSFORMS = ('transforms', LaminDBRegistry.TRANSFORM)

StorageField

Bases: RegistryField

Fields of core.storage (LaminDBRegistry.STORAGE).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

INSTANCE_UID class-attribute instance-attribute

INSTANCE_UID = 'instance_uid'

IS_LOCKED class-attribute instance-attribute

IS_LOCKED = 'is_locked'

REGION class-attribute instance-attribute

REGION = 'region'

ROOT class-attribute instance-attribute

ROOT = 'root'

TYPE class-attribute instance-attribute

TYPE = 'type'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

BRANCH_ID class-attribute instance-attribute

BRANCH_ID = 'branch_id'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_ON_ID class-attribute instance-attribute

CREATED_ON_ID = 'created_on_id'

RUN_ID class-attribute instance-attribute

RUN_ID = 'run_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

BRANCH class-attribute instance-attribute

BRANCH = ('branch', LaminDBRegistry.BRANCH)

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

CREATED_ON class-attribute instance-attribute

CREATED_ON = ('created_on', LaminDBRegistry.BRANCH)

RUN class-attribute instance-attribute

RUN = ('run', LaminDBRegistry.RUN)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

BranchField

Bases: RegistryField

Fields of core.branch (LaminDBRegistry.BRANCH).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

NAME class-attribute instance-attribute

NAME = 'name'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

SPACE_ID class-attribute instance-attribute

SPACE_ID = 'space_id'

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

SPACE class-attribute instance-attribute

SPACE = ('space', LaminDBRegistry.SPACE)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

ULABELS class-attribute instance-attribute

ULABELS = ('ulabels', LaminDBRegistry.ULABEL)

USERS class-attribute instance-attribute

USERS = ('users', LaminDBRegistry.USER)

SpaceField

Bases: RegistryField

Fields of core.space (LaminDBRegistry.SPACE).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

DESCRIPTION class-attribute instance-attribute

DESCRIPTION = 'description'

NAME class-attribute instance-attribute

NAME = 'name'

CREATED_BY_ID class-attribute instance-attribute

CREATED_BY_ID = 'created_by_id'

CREATED_BY class-attribute instance-attribute

CREATED_BY = ('created_by', LaminDBRegistry.USER)

UserField

Bases: RegistryField

Fields of core.user (LaminDBRegistry.USER).

ID class-attribute instance-attribute

ID = 'id'

UID class-attribute instance-attribute

UID = 'uid'

CREATED_AT class-attribute instance-attribute

CREATED_AT = 'created_at'

HANDLE class-attribute instance-attribute

HANDLE = 'handle'

NAME class-attribute instance-attribute

NAME = 'name'

UPDATED_AT class-attribute instance-attribute

UPDATED_AT = 'updated_at'

ARTIFACTS class-attribute instance-attribute

ARTIFACTS = ('artifacts', LaminDBRegistry.ARTIFACT)

BRANCHES class-attribute instance-attribute

BRANCHES = ('branches', LaminDBRegistry.BRANCH)

CREATED_ARTIFACTS class-attribute instance-attribute

CREATED_ARTIFACTS = ('created_artifacts', LaminDBRegistry.ARTIFACT)

CREATED_RUNS class-attribute instance-attribute

CREATED_RUNS = ('created_runs', LaminDBRegistry.RUN)

CREATED_TRANSFORMS class-attribute instance-attribute

CREATED_TRANSFORMS = ('created_transforms', LaminDBRegistry.TRANSFORM)

LINKED_IN_RECORDS class-attribute instance-attribute

LINKED_IN_RECORDS = ('linked_in_records', LaminDBRegistry.RECORD)

PROJECTS class-attribute instance-attribute

PROJECTS = ('projects', LaminDBRegistry.PROJECT)

airflow.providers.lamindb.exceptions

LaminDBApiError

LaminDBApiError(
    message: str,
    *,
    http_status_code: int | None = None,
    detail: Any = None,
    transient: bool = False,
)

Bases: AirflowException

Raised when the LaminHub REST API returns an error response.

transient is true when the request may succeed if repeated later: network errors, rate limiting (429) and server errors (5xx).

Source code in src/airflow/providers/lamindb/exceptions.py
def __init__(
    self,
    message: str,
    *,
    http_status_code: int | None = None,
    detail: Any = None,
    transient: bool = False,
) -> None:
    super().__init__(message)
    self.http_status_code = http_status_code
    self.detail = detail
    self.transient = transient

LaminDBVersionError

Bases: AirflowFailException, ValueError

Raised for lamindb older than the provider supports; tasks fail without retries.