Created
May 10, 2024 20:00
-
-
Save Bilbottom/ca53c6ef3c377844e04c7cccd90eca26 to your computer and use it in GitHub Desktop.
DuckDB's `FROM` statement accepts glob patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
DuckDB's `FROM` statement accepts glob patterns | |
DuckDB version: 0.10.2 | |
Bill Wallis, 2024-05-10 | |
*/ | |
select version(); | |
/* | |
You'll need to create the folders manually first: | |
`data/` | |
`data/sub/` | |
`data/sub/subsub/ | |
See the following for more information: | |
- https://github.com/duckdb/duckdb/discussions/10665 | |
*/ | |
copy (select 1 as a, 2 as b, 3 as c) to 'data/one.csv'; | |
copy (select 4 as a, 5 as b, 6 as c) to 'data/two.csv'; | |
copy (select 7 as a, 8 as b, 9 as c) to 'data/sub/three.csv'; | |
copy (select 0 as a, 0 as b, 0 as c) to 'data/sub/subsub/four.csv'; | |
/* Just file headers */ | |
from 'data/**/*.csv'; | |
/* File headers with filenames */ | |
from read_csv('data/**/*.csv', filename=true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is part of the following LinkedIn post:
https://www.linkedin.com/posts/bill-wallis_sql-duckdb-activity-7194788778744442880-Uw0S