csv-parser: tighten CsvFormatTemplate generics + last_used_at note
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
3f1d2a1034
commit
fb3498efb0
1 changed files with 7 additions and 3 deletions
|
|
@ -446,15 +446,19 @@ class CsvFormatTemplate(Base):
|
||||||
|
|
||||||
id: Mapped[int] = mapped_column(_PK, primary_key=True, autoincrement=True)
|
id: Mapped[int] = mapped_column(_PK, primary_key=True, autoincrement=True)
|
||||||
fingerprint: Mapped[str] = mapped_column(String(64), unique=True, nullable=False)
|
fingerprint: Mapped[str] = mapped_column(String(64), unique=True, nullable=False)
|
||||||
headers: Mapped[list] = mapped_column(JSON, nullable=False)
|
headers: Mapped[list[str]] = mapped_column(JSON, nullable=False)
|
||||||
sample_row: Mapped[list] = mapped_column(JSON, nullable=False)
|
sample_row: Mapped[list[str]] = mapped_column(JSON, nullable=False)
|
||||||
mapping: Mapped[dict] = mapped_column(JSON, nullable=False)
|
mapping: Mapped[dict[str, str | None]] = mapped_column(JSON, nullable=False)
|
||||||
preamble_rows: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
preamble_rows: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||||
delimiter: Mapped[str] = mapped_column(String(1), nullable=False, default=",")
|
delimiter: Mapped[str] = mapped_column(String(1), nullable=False, default=",")
|
||||||
broker_label: Mapped[str | None] = mapped_column(String(128))
|
broker_label: Mapped[str | None] = mapped_column(String(128))
|
||||||
first_seen_at: Mapped[datetime] = mapped_column(
|
first_seen_at: Mapped[datetime] = mapped_column(
|
||||||
DateTime(timezone=True), nullable=False, default=utcnow,
|
DateTime(timezone=True), nullable=False, default=utcnow,
|
||||||
)
|
)
|
||||||
|
# use_count and last_used_at are application-managed: parse_with_llm
|
||||||
|
# increments use_count and sets last_used_at = utcnow() on every cache hit.
|
||||||
|
# No onupdate hook — we don't want unrelated writes (e.g. broker_label edits)
|
||||||
|
# to re-stamp last_used_at.
|
||||||
use_count: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
use_count: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
||||||
last_used_at: Mapped[datetime] = mapped_column(
|
last_used_at: Mapped[datetime] = mapped_column(
|
||||||
DateTime(timezone=True), nullable=False, default=utcnow,
|
DateTime(timezone=True), nullable=False, default=utcnow,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue