You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/home/frankier/edu/rse/apitofsim/duckdbinsertpls.py", line 16, in <module>
db.table("cool_numbers").insert((42,))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
_duckdb.BinderException: Binder Error: table cool_numbers has 2 columns but 1 values were supplied
Traceback (most recent call last):
File "/home/frankier/edu/rse/apitofsim/duckdbinsertpls.py", line 21, in <module>
db.table("cool_numbers").insert((None, 42))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
_duckdb.ConstraintException: Constraint Error: Failed to insert into table 'cool_numbers': NOT NULL constraint failed: cool_numbers.id
Traceback (most recent call last):
File "/home/frankier/edu/rse/apitofsim/duckdbinsertpls.py", line 26, in <module>
db.table("cool_numbers").select("number").insert((42,))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
_duckdb.InvalidInputException: Invalid Input Error: 'DuckDBPyRelation.insert' can only be used on a table relation
Rather than using None, there could be some sort of duckdb.DEFAULT sentinel.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
It does not currently seem possible to use
insert(...)from the relational API https://duckdb.org/docs/stable/clients/python/relational_api#insert together with default column values.Here's some ways it could work:
Here's the output:
Rather than using None, there could be some sort of
duckdb.DEFAULTsentinel.Beta Was this translation helpful? Give feedback.
All reactions