<@U088WCP3B4P> How can I update specific metadata ...
# ask-elementary-ai
l
@kapa.ai How can I update specific metadata tables manually?
k
A message from kapa.ai
You can manually update specific metadata tables in Elementary by running the corresponding dbt model directly. For example, to update the
dbt_models
or
dbt_tests
metadata tables, you can use:
Copy code
dbt run --select dbt_models
or
Copy code
dbt run --select dbt_tests
This will refresh the metadata in those tables with the current state of your dbt project. This approach is useful if you notice outdated metadata or after making changes to your project configuration or structure. The artifact tables (like
dbt_models
,
dbt_tests
, etc.) are also automatically updated at the end of your dbt job via the
on-run-end
hook, but manual runs can be used for immediate updates as needed [Elementary dbt package on-run-end hooks](https://docs.elementary-data.com/dbt/on-run-end_hooks) [Slack answer on updating dbt_tests](https://slack.com/archives/C02CTC89LAX/p1687274511137429). If you want to update all metadata tables at once, you can run:
Copy code
dbt run --select elementary
or
Copy code
dbt run --select dbt_models,dbt_tests
as appropriate for your needs [Slack answer on updating metadata](https://slack.com/archives/C02CTC89LAX/p1664201089481529).
l
@kapa.ai How can I run a full-refresh, because I've got duplicates in my metadata tables
k
A message from kapa.ai
To run a full-refresh of your Elementary metadata tables (which can help resolve duplicates), you should use the following command:
Copy code
dbt run --select elementary --vars '{"elementary_full_refresh": "true"}'
This command ensures that all Elementary incremental models, including your metadata tables, are fully refreshed and duplicates are removed. Note that the standard
--full-refresh
flag alone does not affect Elementary's incremental models; you must set the
elementary_full_refresh
variable as shown above. If you want to be extra thorough, you can also include the
--full-refresh
flag, but the key is the
elementary_full_refresh
variable. Example with both flags:
Copy code
dbt run --select elementary --full-refresh --vars '{"elementary_full_refresh": "true"}'
This approach is confirmed in multiple support threads and documentation as the recommended way to reset or clean up Elementary's metadata tables when facing issues like duplicates [Guides: Package full refresh](https://docs.elementary-data.com/guides/modules-overview/dbt-package#package-full-refresh) [Slack discussion on full refresh and duplicates](https://slack.com/archives/C02CTC89LAX/p1682944161312479) [Slack: Resetting test results](https://slack.com/archives/C02CTC89LAX/p1674823249739599).