Seeds
Seeds are small .csv
files that are used to create small tables with data. They are placed in the seeds
folder, for example seeds/my_file.csv
. When quary runs, it will create a table with the corresponding csv
data from the file.
Warning: Avoid seeds
Seeds are a quick way to create small tables with data. They are meant for small datasets, but ideally avoided altogether for better alternatives.
DuckDb alternative
If you need to read csv
files in DuckDb, we advise using sources, which are more reliable and flexible.
Suppose you have a csv
file called my_file.csv
at the following location compared to the root of your project data/my_file.csv
. You can create a source for it with the following syntax:
sources:
- name: my_file
path: data/my_file.csv
Or you could use:
sources:
- name: my_file
path: read_csv(data/my_file.csv)
Then you can use it in a query like this. This gives you the full power to control how duckdb imports the file. See the duckdb documentation for more information. Equally, this would work for any other type of DuckDb import.
Warehouse alternative
For warehouses, we advise uploading the data in a separate process and referencing it as a source in a project file.
Seeds
If you have decided to use seeds, you can create a seed by placing a csv
file in the seeds
folder, for example seeds/my_file.csv
. Seeds are then reference-able in a model and the name is the name of the file. So in this case my_file
.
You can use it in a query like this:
SELECT * FROM q.my_file