Skip to main content

Field

Descriptor and query DSL: defines field metadata and builds Expr for Catalog search (e.g. Field("source") == "EDGAR").

Constructor

Field(
name: str = "",
_field_type: type | None = None,
indexed: bool = False,
immutable: bool = False,
required: bool = False,
description: str | None = None,
*,
identifier: bool = False,
) -> Field
ParameterDescription
nameField name
_field_typePython type for validation; in Filing subclasses this is often injected from Annotated
indexedIf True, Catalog stores as physical column and search uses column; else stored in JSON and search uses json_extract(data, '$.name')
immutableIf True, value cannot be changed after init (Filing raises FieldImmutableError)
requiredIf True, value must be set at init (Filing raises FilingRequiredError if missing/None)
identifierIf True, included in auto-generated id hash (with other identifier=True fields, sorted by name)
descriptionOptional description

Query DSL (return Expr)

Comparison: ==, !=, >, >=, <, <=.

String: contains(value: str), startswith(value: str), endswith(value: str) (LIKE with %).

Set: in_(values: list), not_in(values: list).

Null: is_null(), is_not_null().

Range: between(lower, upper).

Examples:

Field("source") == "EDGAR"
Field("form").in_(["10-K", "10-Q"])
Field("filing_date").between(d1, d2)
(Field("source") == "EDGAR") & (Field("form") == "10-K")

search/count での利用と・SQL 変換は Collection Search を参照。

Descriptor protocol

Used on Filing subclasses: Field is used inside Annotated[str, Field(...)].

  • Class access FilingClass.field_name: Returns the Field when the field has no class default; when it has a default (e.g. EDINETFiling.source = "EDINET"), returns a reference object that can be used both as left-hand side (e.g. EDINETFiling.source == "EDINET" → Expr) and right-hand side (e.g. Field("source") == EDINETFiling.source → same as == "EDINET").
  • Instance access filing.field_name: Returns the field value.

Method

MethodReturnsDescription
validate_value(value: Any) -> NoneRaises FieldValidationError if value is not compatible with _field_type