Foreign key handled incorrectly
- Dominant language
- Python
- Stars
- 3.2k
- Forks
- 389
- PR merge metrics
- No merged PRs in 30d
Description
I set up a blaze data object with a sqlalchemy select statement, including a foreign key `live_algo_id`
```
t = bz.resource(conn_str, schema='session')
l_ts = bz.Data(select([t.c.id, t.c.ref_id, t.c.live_algo_id]))
```
The dshape of l_ts looks like:
```
dshape("""var * {
id: string,
ref_id: int64,
live_algo_id: map[string, {id: string, log_count: int32}]
}""")
```
But, `odo(l_ts[l_ts.live_algo_id == 'foo'], pd.DataFrame)` always returns the first row of the table, regardless of the value of live_algo_id. I think the correct behavior should be to throw an error, as live_algo_id is a foreign key.
Is there a way I can ignore the contents of the foreign table linked by the foreign key? I only want the key itself.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the SQLAlchemy select passed to bz.resource, the blaze Data expression l_ts.live_algo_id == 'foo', and the odo conversion to pd.DataFrame. Reproduce the filter and determine whether the result should raise for the foreign key or preserve only live_algo_id without linked-table contents; done means it no longer returns the first row regardless of the key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python, sqlalchemy
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100