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
Very new to duckdb (and impressed) and trying to get my head around the python relations and how to use properly.
Is it possible to filter a relation based on a field referring another relation?
my usecase / example simplified:
rel_s=conn.table("scans")
rel_ids=rel_s.filter("section IN ('a','b')").project("id") # gives me [10,20,30]rel_vals=rel_s.filter(f"id IN {tuple(rel_ids.df().id)}").project("id, section, pit").join(conn.table("points"), 'id')
rel_vals.df() # should give me the Df with all the points for scans id from subquery
At the moment I have to get the results of the rel_ids relation convert to a tuple to be able to use in the filter of the second query using IN.
We could do that in one single query with SQL command using a subquery.
So is there a way to do this using the python relations?
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
-
Hi,
Very new to duckdb (and impressed) and trying to get my head around the python relations and how to use properly.
Is it possible to filter a relation based on a field referring another relation?
my usecase / example simplified:
At the moment I have to get the results of the
rel_ids
relation convert to a tuple to be able to use in the filter of the second query usingIN
.We could do that in one single query with SQL command using a subquery.
So is there a way to do this using the python relations?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions