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:
parent
bc34c78072
commit
99b041a0dd
1 changed files with 1 additions and 0 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue