Error when trying to parse multiple rows via Relational API `values`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by running the provided Python reproduction against conn.values() and compare its multi-row behavior with the SQL VALUES query. Trace the Relational API values entry point and identify how nested native objects are interpreted. Done means multiple rows and columns produce scalar columns with the same result shape as SQL VALUES, with coverage for the reported cases.
Written by the indexing model from the issue text.
Description
What happens?
When trying to utilize the values() function for converting a native Python object into a relation, I am unable to create a relation with multiple rows and columns.
To Reproduce
import duckdb
conn = duckdb.connect()
# 1) Base `VALUES` query using straight SQL (correct/expected)
conn.execute("FROM (VALUES (1, 'a'), (2, 'b'))").df()
# 2) 1 row, multiple columns relation (correct/expected)
conn.values([1, 'a']).df()
# 3) 2 rows, multiple columns relation (multiple different attempts - same output below)
conn.values([1, 'a'], [2, 'b']).df()
conn.values([((1), ('a')), ((2), ('b'))]).df()
conn.values(([1, 'a']), ([2, 'b'])).df()
conn.values([[1, 'a'], [2, 'b']]).df()
# 4) 2 rows, multiple columns relation (works, but typed as lists)
conn.values(([1], ['a']), ([2], ['b'])).df()
# 5) Attempted to remove the lists 🤷🏼
conn.values((1, 'a'), (2, 'b'))
Outputs:
# 1)
col0 col1
0 1 a
1 2 b
# 2)
col0 col1
0 1 a
# 3)
col0 col1
0 [1, a] [2, b]
# 4)
[1] ['a']
0 [1] [a]
1 [2] [b]
# 5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
duckdb.duckdb.BinderException: Binder Error: Referenced column "a" not found in FROM clause!
OS:
OSX 15.6
DuckDB Package Version:
1.4.0
Python Version:
3.11
Full Name:
Joe Rimsky
Affiliation:
Gecko Robotics
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
Not applicable - the reproduction does not require a data set
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration to reproduce the issue?
- Yes, I have
- Dominant language
- Python
- Stars
- 186
- Forks
- 113
- Avg merge
- 22h 45m
- Merged PRs (30d)
- 14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from duckdb/duckdb-python
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
duckdb/duckdb-python#633 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
duckdb/duckdb-python#627 ·
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
duckdb/duckdb-python#576 · 3 comments ·
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
duckdb/duckdb-python#534 ·
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
duckdb/duckdb-python#386 ·
All issues in duckdb/duckdb-python
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stephrobert/dsoxlab#238 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sublimehq/package_control#1780 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nwg-piotr/nwg-displays#145 ·