This message was deleted.
# ask-elementary-ai
s
This message was deleted.
k
A message from kapa.ai
Based on the knowledge sources, there are several common reasons why running
dbt run --select elementary
does not create any tables: 1. Elementary Package Not Installed or Not Enabled If the Elementary dbt package is not installed, or if it is disabled in your
dbt_project.yml
, the selection criterion
elementary
will not match any nodes, and no tables will be created. Double-check that your
packages.yml
includes Elementary and that you have run
dbt deps
. Also, ensure that the models are enabled in your
dbt_project.yml
. If you use a variable to control enabling, make sure you pass the correct variable name and value when running the command. For example, if you have:
Copy code
yaml    models:      elementary:        +enabled: "{{ var('cli_enable_elementary', False) }}"
You must run:
Copy code
dbt run --select elementary --vars '{"cli_enable_elementary": true}'
If you use the wrong variable name, the models will remain disabled and nothing will be created. When Elementary is disabled, it behaves as if it is not installed at all, and no tables or logging will occur [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1680689840547609). 2. Version Compatibility Issues Incompatible versions between the Elementary CLI (
edr
) and the Elementary dbt package can cause issues. You should ensure that the versions of the CLI and the dbt package are compatible. If you see a warning about incompatible versions, update your
packages.yml
to match the CLI version, run
dbt deps
, and then try again [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1698373085921559). 3. No Elementary Models Found If you see an error like:
Copy code
The selection criterion 'elementary' does not match any nodes
This means dbt cannot find any models under the
elementary
namespace. This could be due to the package not being installed, being disabled, or a misconfiguration in your project [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1691311028328119). 4. Multiple dbt Projects If you have multiple dbt projects, you need to run
dbt run --select elementary
in each project, and each should have its own Elementary schema [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1691513076109829). Recommended Steps: - Ensure Elementary is listed in your
packages.yml
and run
dbt deps
. - Check your
dbt_project.yml
to confirm the Elementary models are enabled. - Make sure you are using the correct variable name if enabling Elementary via a variable. - Ensure your CLI and dbt package versions are compatible. - Run the command with the correct target if you use multiple targets:
Copy code
dbt run --select elementary --target <your_target>
If after these checks the tables are still not created, please provide any error messages you see for further troubleshooting.
a
@kapa.ai,should I create schema first ?
k
A message from kapa.ai
You do not always need to manually create the schema before running
dbt run --select elementary
. Elementary (and dbt) can create the schema automatically if your user has the necessary permissions to do so. However, if your user does not have permission to create schemas, you will need to create the schema manually before running the command. This is confirmed in a support thread where a user encountered a schema not found or not authorized error in production. The solution was to ensure the schema exists, either by having the right permissions or by creating it manually before running Elementary commands [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1663071133183389). So, if you see errors about the schema not existing or lacking authorization, create the schema first or adjust your permissions accordingly. Otherwise, dbt/Elementary will handle it for you if permissions allow.
a
@kapa.ai I have enough permission but still no action for this command to create tables/schemas dbt run --select elementary
k
A message from kapa.ai
If you have sufficient permissions but running
dbt run --select elementary
does not create any tables or schemas, the most common causes—based on the knowledge sources—are: 1. Elementary Package Not Installed or Not Enabled If the Elementary package is not installed or is disabled in your
dbt_project.yml
, the command will not create any tables. You should check that: - Elementary is listed in your
packages.yml
and you have run
dbt deps
. - The models are enabled in your
dbt_project.yml
. If you use a variable to control enabling, ensure you are passing the correct variable name and value. For example, if you have:
Copy code
yaml      models:        elementary:          +enabled: "{{ var('cli_enable_elementary', False) }}"
You must run:
Copy code
dbt run --select elementary --vars '{"cli_enable_elementary": true}'
Using the wrong variable name or not enabling the models will result in no action [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1680689840547609). 2. No Models Matched by the Selection Criterion If you see a message like:
Copy code
The selection criterion 'elementary' does not match any nodes
This means dbt cannot find any models under the
elementary
namespace, often due to the package not being installed, being disabled, or a misconfiguration [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1691311028328119). 3. Target or Environment Mismatch If you are running the command on a different target or environment than where the package is installed or enabled, no tables will be created. Ensure you are using the correct target with the
--target
flag if needed [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1684095583307509). 4. Version Compatibility Incompatible versions between dbt, Elementary, and dbt_utils can cause the models not to run. While the knowledge sources do not mention your specific version combination, they do recommend ensuring compatibility and updating to the latest versions if issues arise [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1698373085921559). Summary: If you have permissions but nothing happens, the most likely reasons are that the Elementary package is not installed, not enabled, or not matched by your selection. Double-check your
packages.yml
,
dbt_project.yml
, and any variables used for enabling. Also, ensure you are running the command in the correct environment/target. If you still experience issues, please share any warning or error messages you see, as these can provide more specific guidance.
A message from kapa.ai
The error message:
Copy code
Database Error in test elementary_column_anomalies_hourly_booking_volume_1__average__stddev__sum__event_count__hour__1 (models\schema.yml) 002003 (02000): SQL compilation error: Schema 'DBT_ANALYTICS.DEV_ELEMENTARY' does not exist or not authorized.
indicates that the schema
DBT_ANALYTICS.DEV_ELEMENTARY
does not exist or your user does not have the necessary permissions to access or create it. Based on the knowledge sources, this issue is commonly caused by one of the following: 1. Schema Not Created Yet Even if you have permissions, the schema must exist before Elementary can create tables in it. If your user does not have permission to create schemas, you need to create the schema manually. If you do have permission, dbt/Elementary should create it automatically, but sometimes this does not happen due to configuration issues [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1663071133183389). 2. Misconfiguration of Schema Name The schema name is often generated based on your
dbt_project.yml
and any custom macros (like
generate_schema_name
). If the schema name is not what you expect, double-check your configuration and any macros that might alter the schema name [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1687683664366389). 3. Elementary Profile Schema Mismatch The schema that the Elementary CLI (
edr
) or dbt package uses must match the schema where the Elementary tables are created. If you use different schema names for different environments (e.g., dev vs. prod), ensure your
profiles.yml
and
dbt_project.yml
are aligned for the current target [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1687683664366389). What you should do: - Manually create the schema
DBT_ANALYTICS.DEV_ELEMENTARY
in your data warehouse, or ensure your user has permission to create schemas. - Double-check your
dbt_project.yml
and
profiles.yml
to ensure the schema configuration matches your environment and expectations. - If you use a macro like
generate_schema_name
, verify that it produces the intended schema name for your current target. If you address these points and the schema exists (and is accessible), the error should be resolved. If not, please provide more details about your schema configuration and permissions for further troubleshooting.
A message from kapa.ai
Your error message:
Copy code
Couldn't find Elementary's models in `<dbt_analytics.DEV|dbt_analytics.DEV>_ELEMENTARY`. Please run `dbt run -s elementary --target analytics_dev`. ... Database Error in test elementary_column_anomalies_hourly_booking_volume_1__average__stddev__sum__event_count__hour__1 (models\schema.yml) 002003 (02000): SQL compilation error: Schema '<dbt_analytics.DEV|dbt_analytics.DEV>_ELEMENTARY_ELEMENTARY' does not exist or not authorized.
What’s happening: - Elementary is looking for its models in a schema named
DBT_ANALYTICS.DEV_ELEMENTARY_ELEMENTARY
, but that schema does not exist or is not accessible. - The error message suggests that the schema name is being constructed incorrectly, possibly due to how your schema is configured in
dbt_project.yml
and/or your
profiles.yml
, or due to a custom
generate_schema_name
macro. What to check and do: 1. Schema Configuration Conflict If you have both a schema set in your
profiles.yml
(e.g.,
DEV_ELEMENTARY
) and in your
dbt_project.yml
under the
elementary
model (e.g.,
+schema: elementary
), dbt will concatenate them, resulting in
DEV_ELEMENTARY_ELEMENTARY
. This is a common cause for this type of error [see this Slack thread](https://slack.com/archives/C02CTC89LAX/p1687683664366389). 2. How to Fix - Make sure you are not redundantly specifying the schema in both places. - If you want the schema to be
DEV_ELEMENTARY
, set it only in your
profiles.yml
and do not set
+schema: elementary
in your
dbt_project.yml
for the Elementary models. - If you want the schema to be just
elementary
, set it only in your
dbt_project.yml
and use a generic schema in your profile. 3. Custom Schema Macro If you have a custom
generate_schema_name
macro, ensure it is not appending the schema name twice. 4. Manual Schema Creation If you have the correct schema name but it does not exist, create it manually or ensure your user has permission to create schemas. Summary: The schema name is being duplicated due to configuration. Adjust your
dbt_project.yml
and/or
profiles.yml
so that the schema is only set in one place for Elementary, then run:
Copy code
dbt run --select elementary --target analytics_dev
This should create the necessary tables in the correct schema, and your tests should then work as expected. If you continue to have issues, please share your relevant
dbt_project.yml
and
profiles.yml
configurations for more targeted help.