Skip to content

Commit

Permalink
Fix some long-standing type-hinting issues in SAPP models.
Browse files Browse the repository at this point in the history
Summary:
# Problem

We have a lot of Pyre type-errors we've been suppressing since D22039123 landed back in 2020.

# Solution

The thing is, we don't have to live like this. We can just annotate these Column fields on Tables ourselves, with the correct type.

So let's do that, and let's.

Reviewed By: alexblanck, compositor

Differential Revision: D55171548

fbshipit-source-id: 56f6e2978102438de176de48ca05d8711bb1195d
  • Loading branch information
Abdullahi Abdalla authored and facebook-github-bot committed Apr 2, 2024
1 parent e131521 commit 5f1bdfd
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 133 deletions.
7 changes: 2 additions & 5 deletions sapp/db_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,14 @@ class PrimaryKeyBase(PrepareMixin, RecordMixin): # noqa
__tablename__ = "primary_keys"
__table_args__: Tuple[Dict[str, str]] = BASE_TABLE_ARGS

# pyre-fixme[8]: Attribute has type `str`; used as `Column[str]`.
table_name: str = Column(
table_name: Column[str] = Column(
String(length=100),
doc="Name of the table that this row stores the next available primary key for",
nullable=False,
primary_key=True,
)

# pyre-fixme[8]: Attribute has type `int`; used as
# `Column[Variable[sqlalchemy.sql.type_api._U]]`.
current_id: int = Column(
current_id: Column[int] = Column(
BIGINT(unsigned=True).with_variant(BIGINT, "sqlite"),
doc="The current/latest id used in the table.",
nullable=False,
Expand Down
Loading

0 comments on commit 5f1bdfd

Please sign in to comment.