-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
What happens?
Selecting MAP datatype into dataframes creates a column of object
datatype but then trying to reinsert from the dataframe throws a ConversionException: Conversion Error: Unimplemented type for cast (STRUCT(a INTEGER) -> MAP(VARCHAR, INTEGER))
There seems to be no option for doing bulk inserting into MAP columns due to this.
To Reproduce
import duckdb
# Establish a connection to DuckDB (in-memory)
conn = duckdb.connect(":memory:")
# Create a table with a MAP column
conn.execute("""
CREATE TABLE my_table (
id INTEGER,
data MAP(VARCHAR, INTEGER)
)
""")
# manually insert the data
conn.execute("INSERT INTO my_table (id, data) VALUES (1, MAP {'a': 1})")
# Verify the data
result = conn.execute("SELECT * FROM my_table").fetch_df()
print(result)
# id data
# 0 1 {'a': 1}
print(result["data"].dtype)
# object
# try to reinsert queried data
conn.execute("INSERT INTO my_table (id, data) SELECT * FROM result")
# ConversionException: Conversion Error: Unimplemented type for cast (STRUCT(a INTEGER) -> MAP(VARCHAR, INTEGER))
OS:
macOS Intel Silicon
DuckDB Version:
1.2
DuckDB Client:
Python
Hardware:
No response
Full Name:
Raj Veerappan
Affiliation:
Personal
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?
Yes
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
- Yes, I have