How do I: read files?
There are a couple of functions mainly designed for DuckDB:
PRQL
1. prql target:sql.duckdb
3. from (read_parquet "artists.parquet")
4. join (read_csv "albums.csv") (==track_id)
SQL
1. WITH table_0 AS (
2. SELECT
3. *
4. FROM
5. read_parquet('artists.parquet')
6. ),
7. table_1 AS (
8. SELECT
9. *
10. FROM
11. read_csv_auto('albums.csv')
12. )
13. SELECT
14. table_0.*,
15. table_1.*
16. FROM
17. table_0
18. JOIN table_1 ON table_0.track_id = table_1.track_id
Note
These don’t currently have all the DuckDB options. If those would be helpful, please log an issue and it’s a fairly easy addition.
Info
We may be able to reduce the boilerplate WITH table_x AS SELECT * FROM... in future versions.
When specifying file names directly in the FROM clause without using functions, which is allowed in DuckDB, enclose the file names in backticks `` as follows:
PRQL
1. from `artists.parquet`
SQL
1. SELECT
2. *
3. FROM
4. "artists.parquet"
