blaze / blaze/odo

Recursion Depth Exceeded on tables with mutual foreign keys

Open
#427 0 comments 0 reactions 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.