Replies: 4 comments 3 replies
-
We don’t currently support this directly. Probably the most natural way of doing this would be to create a view, and then query the view. You can do that using const sql = await DuckDBClient.sql({athletes: FileAttachment("athletes.csv")});
await sql`
CREATE VIEW cyclists AS SELECT * FROM athletes WHERE sport = 'cycling';
CREATE VIEW gymnasts AS SELECT * FROM athletes WHERE sport = 'gymnastics';
`; Then you can query as: SELECT * FROM gymnasts; Maybe we could add some syntax to make this more convenient. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I think this could work if we know the query ahead of time. What if |
Beta Was this translation helpful? Give feedback.
-
Here's a possibility:
(For some reason (unknown to me) we can't use the usual escaping with |
Beta Was this translation helpful? Give feedback.
-
This works but it introduces accidental complexity that grows with the number of intermediate/derived tables we use. It's complexity that we don't need to contend with in incumbent notebooks like jupyter so I can see it being a difficult sell to convince my peers to give framework a chance |
Beta Was this translation helpful? Give feedback.
-
Suppose I've loaded a table
fruits
into sql and I run a query:Can I later query the results of this query from another sql (or js) block e.g.:
Beta Was this translation helpful? Give feedback.
All reactions