fix: flush article before creating sentiment FK references

ArticleSentiment referenced db_article.id before the Article was flushed,
causing a NotNullViolationError on the article_id column. Adding an explicit
flush after session.add(db_article) ensures the UUID is populated before
creating the foreign key reference.
This commit is contained in:
Viktor Barzin 2026-02-23 20:57:11 +00:00
parent bc34c78072
commit 99b041a0dd
No known key found for this signature in database
GPG key ID: 0EB088298288D958

View file

@ -125,6 +125,7 @@ async def process_article(
content_hash=article.content_hash,
)
session.add(db_article)
await session.flush()
for ticker in tickers:
sentiment = ArticleSentiment(