Skip to content

Fix mypy typecheck failures in sqlmodels view generators - #357

Merged
hf-kklein merged 2 commits into
dependabot/uv/sqlmodel-0.0.47from
copilot/fix-github-actions-job
Oct 1, 2026
Merged

hf-kklein merged 2 commits into
dependabot/uv/sqlmodel-0.0.47from
copilot/fix-github-actions-job

Conversation

Copilot AI commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

The GitHub Actions typecheck job was failing due to five strict type-checking errors across three files in the sqlmodels views modules. This PR resolves those failures to restore a green CI build.

Changes

Metaclass Attribute Resolution

Mypy fails to resolve the __tablename__ property on SQLModelMetaclass when iterating over raw class types to drop database tables. Inline type ignores are applied to silence these false positives:

  • Added # type: ignore[attr-defined] inside:
    • src/fundamend/sqlmodels/migview.py
    • src/fundamend/sqlmodels/ahbview.py
# Before
session.execute(sqlalchemy.text(f"DROP TABLE IF EXISTS {model_class.__tablename__};"))

# After
session.execute(sqlalchemy.text(f"DROP TABLE IF EXISTS {model_class.__tablename__};"))  # type: ignore[attr-defined]

Proper Enum Type Initialization

AhbExpression constructor requires format to be an instance of the EdifactFormat enum, but was being initialized with a raw str:

  • Wrapped row[1] in the EdifactFormat constructor inside src/fundamend/sqlmodels/expression_view.py:
# Before
AhbExpression(
    edifact_format_version=row[0],
    format=row[1],
    ...
)

# After
AhbExpression(
    edifact_format_version=row[0],
    format=EdifactFormat(row[1]),
    ...
)

Co-authored-by: hf-kklein <23094997+hf-kklein@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job Fix mypy typecheck failures in sqlmodels view generators Oct 1, 2026
Copilot AI requested a review from hf-kklein October 1, 2026 10:49
@hf-kklein
hf-kklein marked this pull request as ready for review October 1, 2026 10:51
@hf-kklein
hf-kklein merged commit 89862af into dependabot/uv/sqlmodel-0.0.47 Oct 1, 2026
21 checks passed
@hf-kklein
hf-kklein deleted the copilot/fix-github-actions-job branch October 1, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants