sqlalchemy-stubs icon indicating copy to clipboard operation
sqlalchemy-stubs copied to clipboard

Mypy plugin and stubs for SQLAlchemy

Results 96 sqlalchemy-stubs issues
Sort by recently updated
recently updated
newest added

With a class attribute such as: ```python foobaz = sqlalchemy.orm.relationship( foobar, back_populates="relationxyz", cascade="all, delete, delete-orphan", ) ``` Iterating over the attributes raises: ```python [x for x in myinstance.foobaz] ``` ```...

Columns wrapped in `deferred()` are not recognized as a column and are typed as `Any`. SQLAlchemy docs: https://docs.sqlalchemy.org/en/13/orm/loading_columns.html#deferred-column-loading ```python from sqlalchemy import Column, Integer, String from sqlalchemy.ext.declarative import declarative_base from...

This valid [example](https://docs.sqlalchemy.org/en/13/dialects/postgresql.html#sqlalchemy.dialects.postgresql.array) from the SQLAlchemy documentation fails to type check: ```python from sqlalchemy.dialects.postgresql import array from sqlalchemy.dialects import postgresql from sqlalchemy import select, func stmt = select([ array([1,2]) +...

mypy raised an error on this code: ```python DDL(stmt).execute_if(dialect='postgresql') ``` `error: Argument "dialect" to "execute_if" of "DDLElement" has incompatible type "str"; expected "Optional[Dialect]"` However, [the documentation for this method](https://docs.sqlalchemy.org/en/13/core/ddl.html#sqlalchemy.schema.DDLElement.execute_if) and...

I am passing `MyModel` class to the [`correlate` of an `Exists` clause](https://github.com/dropbox/sqlalchemy-stubs/blob/9b9d26e16fee5a17a58089d4c2ba6c9850a976e5/sqlalchemy-stubs/sql/selectable.pyi#L310) and getting the the following error: >error: Argument 1 to "correlate" of "Exists" has incompatible type "Type[MyModel]"; expected...

If this cannot be used with pyright (isntead of mypy), then what needs to happen so that it can be used with pyright?

mypy seems to think that the type of data in this column is "Union[Dict[str, Any], List[Any]]" which seems reasonable. However, the returned data actually seems to be of type str

Given the following relationship: ```python class Game(Base): __tablename__ = "games" id = Column(Integer, primary_key=True, nullable=False, autoincrement=True) users = relationship("User", back_populates="game") class User(Base): __tablename__ = "users" xid = Column(BigInteger, primary_key=True, nullable=False)...

The accounts object is not recognised as a list, when it is a many to one relationship. Am I doing something wrong here? ``` if TYPE_CHECKING: from .account import Account...

Hi, First off, thanks a lot for your work on this plugin! I am encountering a (somewhat logical) incompatible type error, and was wondering if this is something we should...