Skip to content

Add TopicModelEvent ORM model to augur_data.py#3405

Merged
sgoggins merged 2 commits intoaugurlabs:mainfrom
xiaoha-cloud:topic-modeling-schema-only
Nov 14, 2025
Merged

Add TopicModelEvent ORM model to augur_data.py#3405
sgoggins merged 2 commits intoaugurlabs:mainfrom
xiaoha-cloud:topic-modeling-schema-only

Conversation

@xiaoha-cloud
Copy link
Copy Markdown
Contributor

Description

Add missing TopicModelEvent ORM model to complete schema implementation from PR #3397.

PR #3397 added database migrations for topic_model_meta and topic_model_event tables, but the TopicModelEvent SQLAlchemy model was inadvertently omitted from augur_data.py. This caused ORM-level access failures when attempting to query or manipulate event records.

This PR adds the TopicModelEvent class to complete the ORM layer for the topic modeling schema.

Changes

Added TopicModelEvent ORM model (augur/application/db/models/augur_data.py):

  • 7 table columns: event_id, ts, repo_id, model_id, event, level, payload
  • Index definitions: ix_tme_repo_ts, ix_tme_event
  • Foreign key constraints to repo and topic_model_meta tables
  • Relationship mappings to Repo and TopicModelMeta models

Why This PR?

After merging #3397, it was discovered that while migration 36 created the topic_model_event table in the database, the corresponding ORM model was missing. This prevented the application from accessing event data through SQLAlchemy.

This is a follow-up PR to ensure the ORM layer matches the database schema created by the migrations.

Related

Notes for Reviewers

  • Only adds ORM model definition, no migration changes
  • Model structure matches migration 36 exactly
  • Follows Augur ORM conventions (relationships, foreign keys, indexes)

Signed commits

  • Yes, I signed my commits.

Migration 36 created the topic_model_event table in the database, but
the corresponding SQLAlchemy model was not added to augur_data.py. This
caused ORM-level access to the event table to fail.

This commit adds the TopicModelEvent class with:
- All table columns (event_id, ts, repo_id, model_id, event, level, payload)
- Index definitions for ix_tme_repo_ts and ix_tme_event
- Foreign key constraints to repo and topic_model_meta tables
- Relationship mappings to Repo and TopicModelMeta models

This enables the application to query and manipulate topic modeling
events through the ORM layer.

Related: augur/application/schema/alembic/versions/36_add_topic_model_event.py
Signed-off-by: Xiaoha <blairjade183@gmail.com>
@xiaoha-cloud xiaoha-cloud force-pushed the topic-modeling-schema-only branch from d2f88b2 to 382e7b7 Compare November 13, 2025 20:19
Ensure repo_id column type matches migration definition (sa.Integer)
for complete schema consistency between ORM and database.

Signed-off-by: Xiaoha <blairjade183@gmail.com>
Copy link
Copy Markdown
Collaborator

@MoralCode MoralCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems okay to me

@MoralCode MoralCode added the ready Items tested and seeking additional approvals or a merge. Usually for items under active development label Nov 14, 2025
@MoralCode MoralCode requested a review from sgoggins November 14, 2025 17:30
Copy link
Copy Markdown
Collaborator

@sgoggins sgoggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sgoggins sgoggins merged commit 1c0247d into augurlabs:main Nov 14, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready Items tested and seeking additional approvals or a merge. Usually for items under active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants