Keep AI-Augmented Data in a Separate Table
Imagine we have a SoldAsset table (I work in banking now, so naturally my examples come from the bank) that stores all kinds of movable and immovable goods:
class SoldAsset:
id: int
type: str
value: float
# ...and many other fields
Now we want to create a row by looking at a specific document the client supplied (using our code and LLM calls). We would have to fill exactly the same fields, so my first thought was to just add a field to indicate the provenance:
class SoldAsset:
id: int
type: str
value: float
origin: Literal["ai", "human"]
It looked like a win, because I didn’t have to keep 2 tables in sync. However, some issues came up:
- What if we want to augment an already existing row? Then we need to create a new row, marked as based on the existing one.
- If we supply this info to many teams, it becomes cumbersome to query. Now everybody needs to know to include the flag and select the correct value for
origin. - As my data engineers explained, it is more efficient to migrate data by copying whole tables than by querying on fields. With a lot of volume, the flag approach becomes cumbersome.
That’s why a better choice is a separate table:
class SoldAssetAI:
id: int
type: str
value: float
original_id: int | None