Optionally specify the database type of columns in a seed, by providing a dictionary where the keys are the column names, and the values are a valid datatype (this varies across databases).
Without specifying this, dbt will infer the datatype based on the column values in your seed file.
Specify column types in your
seeds: jaffle_shop: country_codes: +column_types: country_code: varchar(2) country_name: varchar(32)
Or (as of v0.21):
version: 2 seeds: - name: country_codes config: country_code: varchar(2) country_name: varchar(32)
If you have previously run
dbt seed, you'll need to run
dbt seed --full-refresh for the changes to take effect.
Note that you will need to use the fully directory path of a seed when configuring
column_types. For example, for a seed file at
data/marketing/utm_mappings.csv, you will need to configure it like so:
seeds: jaffle_shop: marketing: utm_mappings: +column_types: ...
(Note: preservation of leading zeros works for v0.16.0 onwards)
seeds: jaffle_shop: # you must include the project name warehouse_locations: +column_types: zipcode: varchar(5)
Use this configuration only when required, i.e. when the type inference is not working as expected. Otherwise you can omit this configuration.