dbt-source-importer is a command line tool to import dbt sources. You can easily generate source yaml files from metadata of data warehouse like BigQuery.
You can install dbt-source-importer via go get
command, or download binary file from releases.
go get github.com/syou6162/dbt-source-importer
You can import dbt sources by specifying project, dataset, and table.
./dbt-source-importer --project my-project --dataset my_dataset --table my_table
You can also use your custom template.
./dbt-source-importer --project my-project --dataset my_dataset --table my_table --template templates/source.tmpl.yml
You can modify output directories and file names, using source metadata.
# ProjectForPath means your Project ID with hyphens(-) replaced by underscores(_).
./dbt-source-importer --project my-project --dataset my_dataset --table my_table --outdir models/{{.ProjectForPath}}/your_directory --outfile {{.Dataset}}__{{.Table}}.yml