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
A library that receives a DuckDBPyRelation from its caller cannot reach the connection that relation belongs to. Two consequences, both hit in Narwhals:
We cannot follow DuckDB's own threading guidance on the user's behalf: the multiple threads guide says each thread must call .cursor() on the connection. Holding only a relation, there is nothing to call it on.
We cannot anticipate the cross-connection error with a useful message: join, union and cross all raise:
Invalid Input Error: Cannot combine LEFT and RIGHT relations of different connections!
Our API takes two user-supplied frames and combines them internally, so this surfaces from deep inside our call stack with no indication that the cause is which connection each frame came from.
What would help
Either of:
a read-only DuckDBPyRelation.connection property, which solves both cases; or
a narrower rel_a.same_connection_as(rel_b) predicate, which solves only (2) but exposes no connection mutation.
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.
Follow-up to discussion #580.
Problem
A library that receives a
DuckDBPyRelationfrom its caller cannot reach the connection that relation belongs to. Two consequences, both hit in Narwhals:We cannot follow DuckDB's own threading guidance on the user's behalf: the multiple threads guide says each thread must call
.cursor()on the connection. Holding only a relation, there is nothing to call it on.We cannot anticipate the cross-connection error with a useful message:
join,unionandcrossall raise:Our API takes two user-supplied frames and combines them internally, so this surfaces from deep inside our call stack with no indication that the cause is which connection each frame came from.
What would help
Either of:
DuckDBPyRelation.connectionproperty, which solves both cases; orrel_a.same_connection_as(rel_b)predicate, which solves only (2) but exposes no connection mutation.All reactions