Your own semantic models are already in the latest YAML spec, but dbt v2 still prints the legacy warning on every command:
[warning] [SemanticModelDeprecated (dbt1157)]: The package 'shop' defines semantic models and metrics
using the legacy YAML. Please migrate to the new YAML to use the semantic layer with dbt.
The usual culprit is a folder you never look at: models/example/ from a template, a copied sample
project, a tutorial. One semantic_models: block anywhere in the project is enough to trigger the warning.
Copy and paste
Find the files that use the legacy keys:
grep -rln "semantic_models:\|type_params:\|measures:" models/
models/example/schema.yml
If you don’t need them, delete the folder:
git rm -r models/example
Or keep the files but hide them from dbt, in .dbtignore at the project root:
models/example/
If you need them, migrate them like the rest of the project:
dbt-autofix deprecations --semantic-layer
Disabling does not help
The first idea is usually to disable the folder in dbt_project.yml. Tested on dbt v2 2.0.9, none of
these removed the warning:
models:
shop:
example:
+enabled: false
semantic-models:
shop:
example:
+enabled: false
metrics:
shop:
example:
+enabled: false
The warning is raised while the YAML is read, before configurations such as enabled are applied. Disabled
or not, the legacy block is still in the project. Deleting the folder or listing it in .dbtignore removes
it from what dbt reads, and the warning disappears.
Read the package name
The warning names a package. If it is your project’s name (shop above), the files are yours, somewhere
under model-paths. If it is the name of an installed package, the legacy YAML is in dbt_packages/, which
dbt-autofix does not change: upgrade the package to a version that uses the latest spec, or ask its
maintainer to migrate it.
The warning that may follow
Once the legacy YAML is gone, a dbt v2 project with no connection to dbt platform may print:
[warning] [InvalidConfig (dbt1005)]: Skipping semantic manifest validation due to: No dbt_cloud.yml
config. Set DBT_ENGINE_NO_WARN_SEMANTIC_MANIFEST_VALIDATION to suppress this warning.
It only says that the semantic checks were skipped. Validate locally with mf validate-configs, or set the
variable to silence it:
export DBT_ENGINE_NO_WARN_SEMANTIC_MANIFEST_VALIDATION=1
Tested with dbt v2 2.0.9.