Search code examples
readabilitydbtschema.yml

DBT breaking up schema.yml file


We have a large schema.yml file in our DBT folders. It is not the cleanest or easiest to find what we need in it. I am curious if anyone knows of a way to split up this file. I am not trying to overcomplicate things and separate the dbt project into multiple or anything like that but rather just work on cleaning up the schema.yml file for readability etc. Thanks!


Solution

  • You can split this up as much as one model per file, and call the files whatever you want.

    The way I usually do it is one file per model and name the file the same as the model.

    Just make sure you have

    version: 2
    
    models:
    

    at the top of your file and you’re good to go!