dropbox / dropbox/sqlalchemy-stubs
`backref` relationships raise `has no attribute`
- Dominant language
- Python
- Stars
- 583
- Forks
- 96
- PR merge metrics
- No merged PRs in 30d
Description
For example, the following code fails to validate:
```python
from sqlalchemy.orm import backref, relationship
from sqlalchemy.sql.schema import Column, ForeignKey
from sqlalchemy.sql.sqltypes import Integer
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class A(Base):
id = Column(Integer, primary_key=True)
class B(Base):
id = Column(Integer, primary_key=True)
a_id = Column(
Integer, ForeignKey('a.id', ondelete='CASCADE'), index=True, nullable=False
)
a = relationship(A, backref=backref('bs'))
print(B().a)
print(A().bs)
```
```
sql.py:24: error: "A" has no attribute "bs"
Found 1 error in 1 file (checked 1 source file)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.