Skip to main content

v1

directory_metadata record, v1 — canonical aliases.

Consumers and the record registry import from here and never touch the inner module names, mirroring types/file_metadata/v1/__init__.py.

Module​

Submodules​

Classes​

ORM​

class ORM(**kwargs):

SQLAlchemy model for the directory_metadata cache table.

One row per directory under a datasource root, holding the mtime a pass last saw. Creating, deleting or renaming a file bumps its parent directory's mtime and nothing above it, so comparing these rows against a single stat per directory finds every directory whose contents changed without listing any of them.

Sibling to file_metadata rather than a column on it: the grain is a directory, not a file, and the two are written and read independently.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.

Variables​

  • dataset_identifier : sqlalchemy.orm.base.Mapped[str | None]
  • datasource_type : sqlalchemy.orm.base.Mapped[str | None]
  • directory_path : sqlalchemy.orm.base.Mapped[str]
  • indexed_at : sqlalchemy.orm.base.Mapped[str | None]
  • modified_at : sqlalchemy.orm.base.Mapped[float | None]
  • relist_required : sqlalchemy.orm.base.Mapped[bool]
  • run_id : sqlalchemy.orm.base.Mapped[str | None]
  • source_path : sqlalchemy.orm.base.Mapped[str | None]
  • tags : sqlalchemy.orm.base.Mapped[dict[str, typing.Any] | None]
  • task_hash : sqlalchemy.orm.base.Mapped[str]

Record​

class Record(**data: Any):

The mtime of one directory, as a pass last saw it.

modified_at is a POSIX timestamp rather than the ISO-8601 string file_metadata stores. That table compares with a one-second tolerance precisely because the string round-trip loses sub-second precision; a directory probe compares for exact inequality, so it keeps the float the filesystem gave it and no precision is lost in storage.

It is nullable because the walk that records a directory does not read its mtime: doing so would cost a stat per directory on the index pass, and the parent's listing cannot supply it (no timestamps at all on Linux and macOS; on Windows the stale copy in the parent's NTFS index). A row is written with modified_at unset and the first scan fills it in from the stat it was going to make anyway.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables​

  • static dataset_identifier : str | None
  • static datasource_type : str | None
  • static directory_path : str
  • static indexed_at : str | None
  • static model_config
  • static modified_at : float | None
  • static relist_required : bool
  • static run_id : str | None
  • static source_path : str | None
  • static task_hash : str