aeat.adapters.persistence.storage.sql.records module

Public pydantic v2 record models for the storage layer.

These types are the boundary-crossing surface of adapters.persistence.storage. Callers outside the subpackage always work with these records — never with the internal SQLAlchemy mapper classes from adapters.persistence.storage.sql._orm.

Every record consumes the canonical STRICT_FROZEN_CONFIG (strict=True, frozen=True, extra="forbid") per the project pydantic mandate, so an unexpected column projected from the ORM boundary is refused rather than silently dropped.

Note

str string fields (name, label) are plain str today. Once the shared multilingual primitive lands, these fields will be migrated to the Translatable shape.

class PortalAuthMethod(*values)[source]

Bases: StrEnum

Closed catalogue of supported AEAT portal authentication methods.

Variables:
  • CLAVECl@ve PIN / Cl@ve Permanente based authentication.

  • CERTIFICATE – Software / hardware X.509 certificate authentication.

  • DNIE – Spanish electronic ID card authentication.

  • NONE – Public area, no authentication required.

CLAVE
CERTIFICATE
DNIE
NONE
class ModeloCatalogueRecord(**data)[source]

Bases: _StrictFrozen

Public record for a row in the modelos table.

Variables:
  • id – Surrogate primary key. None for records not yet persisted.

  • identifier – Stable natural key for the modelo record.

  • name – Human-readable modelo name (translatable, see module note).

Parameters:
  • id (int | None)

  • identifier (str)

  • name (str)

id: int | None
identifier: str
name: str
class PortalRecord(**data)[source]

Bases: _StrictFrozen

Public record for a row in the portals table.

Variables:
  • id – Surrogate primary key. None for records not yet persisted.

  • identifier – Stable natural key (e.g. SEDE_ELECTRONICA_ROOT).

  • base_url – Canonical URL for the portal.

  • auth_method – Authentication method (closed enum).

  • modelo_id – Optional foreign key to ModeloCatalogueRecord.

  • label – Human-readable label (translatable, see module note).

Parameters:
id: int | None
identifier: str
base_url: str
auth_method: PortalAuthMethod
modelo_id: int | None
label: str
class CorpusArtifactRecord(**data)[source]

Bases: _StrictFrozen

Public record for a row in the corpus_artifacts table.

Variables:
  • id – Surrogate primary key. None for records not yet persisted.

  • year – Tax year this artifact belongs to.

  • modelo_id – Foreign key to the owning ModeloCatalogueRecord.

  • file_path – Project-relative path to the on-disk artifact.

  • sha256 – Hex digest of the artifact bytes.

  • source_url – URL the artifact was fetched from.

  • fetched_at – Timestamp when the artifact was fetched (UTC).

Parameters:
id: int | None
year: int
modelo_id: int
file_path: str
sha256: str
source_url: str
fetched_at: datetime