Recursion Depth Exceeded on tables with mutual foreign keys
- Dominant language
- Python
- Stars
- 1k
- Forks
- 131
- PR merge metrics
- No merged PRs in 30d
Description
If you have tables with foreign keys to each other, `odo.backends.sql.discover_sqlalchemy_selectable` gets into an infinite loop. It is reproducible with the following snippet.
```
import sqlalchemy as sa
from odo.backends import sql
meta = sa.MetaData()
UserData = sa.Table(
'userdata',
meta,
sa.Column('id', sa.INTEGER(), primary_key=True, nullable=False),
sa.Column('spouse_id', sa.INTEGER(), sa.ForeignKey('user.id')),
)
User = sa.Table(
'user',
meta,
sa.Column('id', sa.INTEGER(), primary_key=True, nullable=False),
sa.Column('userdata_id', sa.INTEGER(), sa.ForeignKey('userdata.id')),
)
sql.discover_sqlalchemy_selectable(User)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.