> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elementary-data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Elementary dbt package models

## Run Results Tables

These tables track execution details, test outcomes, and performance metrics from your dbt runs.

### dbt\_run\_results

*Incremental model*

Run results of dbt invocations, inserted at the end of each invocation.
Each row is the invocation result of a single resource (model, test, snapshot, etc).
New data is loaded to this model on an on-run-end hook named `elementary.upload_run_results` from each invocation that produces a result object.

<Accordion title="Key Columns">
  * `model_execution_id` (string) - Execution id generated by joining the unique\_id of the resource and the invocation\_id. This is the unique key of each row.
  * `unique_id` (string) - The unique id of the resource (would be similar for all executions of the same resource).
  * `invocation_id` (string) - The unique id of the invocation (would be similar for all resources executed on the same invocation). Foreign key to `dbt_invocations`.
  * `name` (string) - Resource name.
  * `status` (string) - Execution result status (success, error, pass, fail).
  * `resource_type` (string) - Resource type (model, test, snapshot, seed, etc).
  * `execution_time` (float) - Resource execution duration in seconds.
  * `execute_started_at` (string) - Start time of the execution.
  * `execute_completed_at` (string) - End time of the execution.
  * `compile_started_at` (string) - Start time of resource compile action.
  * `compile_completed_at` (string) - End time of resource compile action.
  * `rows_affected` (int) - Number of rows affected by the execution.
  * `full_refresh` (boolean) - Whether this was a full refresh execution.
  * `compiled_code` (string) - The compiled code (SQL / Python) executed against the database. For microbatch incremental models, this column requires [extra setup](/cloud/guides/microbatch-compiled-code).
  * `failures` (int) - Number of failures in this run.
  * `query_id` (string) - Query ID in the data warehouse, if returned by the adapter (currently only supported in Snowflake, is null for any other adapter).
  * `thread_id` (string) - Id of the thread of this resource run.
  * `adapter_response` (string) - Response returned by the adapter (Fields will be different for each adapter).
  * `message` (string) - Execution results message returned by dbt.
  * `generated_at` (string) - Timestamp when the result was generated.
</Accordion>

### dbt\_invocations

*Incremental model*

Attributes associated with each dbt invocation, inserted at the end of each invocation.
Each row is the result of a single invocation (dbt run, dbt test, dbt build, etc).
New data is loaded to this model on an on-run-end hook named `elementary.upload_dbt_invocation`.
It also contains information about your job or what triggered the invocation such as `pull_request_id`, `git_sha`, or `cause`.
If you're using an orchestrator that Elementary natively supports such as dbt Cloud or GitHub Actions,
this data is automatically populated, otherwise, you can populate it by using environment variables in the form of `DBT_<COLUMN_NAME>`.
For instance, adding `DBT_JOB_NAME` will populate `dbt_invocations.job_name` with the value of the environment variable.

<Accordion title="Key Columns">
  * `invocation_id` (string) - Primary key of this table.
  * `run_started_at` (string) - Timestamp the invocation was started.
  * `run_completed_at` (string) - Timestamp the invocation was completed.
  * `generated_at` (string) - The time this invocation was uploaded to the database.
  * `command` (string) - dbt command that was used (e.g., run, test, build).
  * `dbt_version` (string) - Version of dbt that was used in this invocation.
  * `elementary_version` (string) - Version of the elementary package that was used in this invocation.
  * `full_refresh` (boolean) - Whether or not this invocation was executed as a full-refresh.
  * `target_name` (string) - Name of the target used in this invocation.
  * `target_database` (string) - Name of the target database that was used in this invocation.
  * `target_schema` (string) - Name of the target schema that was used in this invocation.
  * `target_profile_name` (string) - Name of the dbt profile that was used in this invocation.
  * `threads` (integer) - Number of threads that were used to run this dbt invocation.
  * `selected` (string) - The selected resources in the dbt command. While this is a string in the database, this can easily be converted to an array.
  * `yaml_selector` (string) - The yaml selector that was passed in this invocation.
  * `job_id` (string) - The ID of a job, defined in the `job_id` var or in the `JOB_ID` env var or by the orchestrator.
  * `job_name` (string) - The name of a job, defined in the `job_name` var or in the `JOB_NAME` env var.
  * `job_run_id` (string) - The run ID of a job, defined in the `job_run_id` var or in the `DBT_JOB_RUN_ID` env var or by the orchestrator.
  * `env` (string) - The environment's name, defined in the `DBT_ENV` env var.
  * `env_id` (string) - The ID of an environment, defined in the `DBT_ENV_ID` env var.
  * `project_id` (string) - The ID of a project, defined in the `DBT_PROJECT_ID` env var or by the orchestrator.
  * `cause_category` (string) - The category of the cause of the invocation (e.g., schedule, manual).
  * `cause` (string) - The cause of the invocation (e.g., "Kicked off by Joe").
  * `pull_request_id` (string) - The ID of a pull request, defined in the `DBT_PULL_REQUEST_ID` env var or by the orchestrator.
  * `git_sha` (string) - The git SHA of the commit that was used in this invocation.
  * `orchestrator` (string) - The orchestrator that was used to run this invocation (e.g., dbt Cloud, GitHub Actions).
  * `job_url` (string) - The URL of the job, defined in the `job_url` var or in the `JOB_URL` env var or by the orchestrator.
  * `account_id` (string) - The ID of the account, defined in the `account_id` var or in the `ACCOUNT_ID` env var or by the orchestrator.
  * `invocation_vars` (string) - Dictionary of the variables (and values) that were declared in the invocation.
  * `vars` (string) - Dictionary of all variables (and values) in the dbt project.
</Accordion>

### model\_run\_results

*View*

Run results of dbt models, enriched with models metadata.
Each row is the result of a single model.
This is a view that joins data from `dbt_run_results` and `dbt_models`.

**Columns:** Combines all columns from `dbt_run_results` with metadata from `dbt_models` such as `database_name`, `schema_name`, `tags`, `owner`, `materialization`, `package_name`, `path`, `original_path`, and `alias`.

### snapshot\_run\_results

*View*

Run results of dbt snapshots, enriched with snapshots metadata.
Each row is the result of a single snapshot.
This is a view that joins data from `dbt_run_results` and `dbt_snapshots`.

**Columns:** Combines all columns from `dbt_run_results` with metadata from `dbt_snapshots` such as `database_name`, `schema_name`, `tags`, `owner`, `materialization`, `package_name`, `path`, `original_path`, and `alias`.

### seed\_run\_results

*View*

Run results of dbt seeds, enriched with seeds metadata.
Each row is the result of a single seed.
This is a view that joins data from `dbt_run_results` and `dbt_seeds`.

**Columns:** Combines all columns from `dbt_run_results` with metadata from `dbt_seeds` such as `database_name`, `schema_name`, `tags`, `owner`, `package_name`, `path`, `original_path`, and `alias`.

### job\_run\_results

*View*

Run results of dbt invocations, enriched with jobs metadata.
Each row is the result of a single job.
This is a view on `dbt_invocations`.

**Columns:** All columns from `dbt_invocations` table.

### elementary\_test\_results

*Incremental model*

Run results of all dbt tests, with fields and metadata needed to produce
the [Elementary report](/cloud/features/collaboration-and-communication/data-observability-dashboard).
Each row is the result of a single test, including native dbt tests, packages tests and elementary tests.
New data is loaded to this model on an on-run-end hook named `elementary.handle_tests_results`.

<Accordion title="Key Columns">
  * `id` (string) - Unique identifier for the test result.
  * `test_unique_id` (string) - The unique id of the test.
  * `invocation_id` (string) - The unique id of the invocation. Foreign key to `dbt_invocations`.
  * `detected_at` (timestamp) - When the test result was detected.
  * `created_at` (timestamp) - When the test result record was created.
  * `status` (string) - Test result status (pass, fail, error, warn).
  * `result_rows` (int) - Number of rows that failed the test (for failing tests).
  * `failures` (int) - Number of failures.
  * Additional columns include test metadata, execution details, and test-specific information.
</Accordion>

### test\_result\_rows

*Incremental model*

Failed test row samples. Each row contains a sample of data that caused a test to fail, including the test result ID that links to the parent test result, the actual sample data stored as JSON, and timestamps for detection and creation. By default, up to 5 sample rows are stored per failed test (configurable via [test\_sample\_row\_count](https://docs.elementary-data.com/oss/general/faq#can-i-see-more-result-samples-in-the-report)).

<Accordion title="Key Columns">
  * `id` (string) - Unique identifier for the test result row.
  * `test_result_id` (string) - Links to the parent test result in `elementary_test_results`.
  * `result_row` (string/JSON) - Sample data that caused the test to fail, stored as JSON.
  * `detected_at` (timestamp) - When the failing row was detected.
  * `created_at` (timestamp) - When the record was created.
</Accordion>

### dbt\_source\_freshness\_results

*Incremental model*

Results from dbt source freshness checks. Tracks when source data was last updated and whether it meets freshness thresholds.

<Accordion title="Key Columns">
  * `source_freshness_execution_id` (string) - Unique identifier for the freshness check execution.
  * `unique_id` (string) - The unique id of the source.
  * `max_loaded_at` (string) - The maximum loaded\_at timestamp found in the source data.
  * `snapshotted_at` (string) - When the freshness check was performed.
  * `generated_at` (string) - When the result was generated.
  * `created_at` (timestamp) - When the record was created.
  * `max_loaded_at_time_ago_in_s` (float) - How many seconds ago the max\_loaded\_at timestamp was.
  * `status` (string) - Freshness check status (pass, warn, error).
  * `error` (string) - Error message if the check failed.
  * `compile_started_at` (string) - Start time of compilation.
  * `compile_completed_at` (string) - End time of compilation.
  * `execute_started_at` (string) - Start time of execution.
  * `execute_completed_at` (string) - End time of execution.
  * `invocation_id` (string) - The unique id of the invocation. Foreign key to `dbt_invocations`.
  * `warn_after` (string) - Freshness warning threshold.
  * `error_after` (string) - Freshness error threshold.
  * `filter` (string) - Filter expression used in the freshness check.
</Accordion>

## Metadata Tables - dbt Artifacts

These tables provide a comprehensive view of your dbt project structure and configurations.

The dbt artifacts models are created as empty tables, and a post-hook macro inserts data from the dbt graph object to
the table.
**Each time the model is executed, the data is replaced with the project's current graph.**
It is recommended to execute these models every time a change is merged to the project.

### dbt\_models

*Table*

Metadata about all the models in the project and project packages.
Each row contains information about the properties of a single model, including columns like tags, owner,
materialization, depends\_on, and description.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the model.
  * `name` (string) - Model name.
  * `alias` (string) - Model alias.
  * `database_name` (string) - The model database name.
  * `schema_name` (string) - The model schema name.
  * `materialization` (string) - The model materialization config (e.g., table, view, incremental).
  * `tags` (string) - Model tags property (stored as JSON array string).
  * `meta` (string) - The content of 'meta' property key (stored as JSON string).
  * `owner` (string) - Model owner property (configured under 'meta' key).
  * `description` (string) - Model description.
  * `package_name` (string) - Package name of the model.
  * `path` (string) - Short path of the model file.
  * `original_path` (string) - Full path of the model file.
  * `checksum` (string) - Model file checksum.
  * `depends_on_macros` (string) - The macros the model directly depends on (stored as JSON array string).
  * `depends_on_nodes` (string) - The nodes the model directly depends on (stored as JSON array string).
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_tests

*Table*

Metadata about all the tests in the project and project packages.
Each row contains information about the properties of a single test, including columns like severity, parent model
unique id, tags and owner of the parent model, test params, and the test compiled query.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the test.
  * `name` (string) - The test name.
  * `short_name` (string) - Short name of the test.
  * `alias` (string) - Test alias.
  * `type` (string) - Test type (e.g., singular, generic).
  * `test_namespace` (string) - Namespace of the test (e.g., elementary, dbt\_utils).
  * `database_name` (string) - The tested model database name.
  * `schema_name` (string) - The tested model schema name.
  * `test_column_name` (string) - The name of the tested column (null for table-level tests).
  * `parent_model_unique_id` (string) - The unique id of the model this test is attached to.
  * `severity` (string) - Test severity (error, warn).
  * `warn_if` (string) - Warning condition.
  * `error_if` (string) - Error condition.
  * `test_params` (string) - Test parameters (stored as JSON string).
  * `tags` (string) - Test tags (stored as JSON array string).
  * `model_tags` (string) - Tags from the parent model (stored as JSON array string).
  * `model_owners` (string) - Owners from the parent model (stored as JSON array string).
  * `meta` (string) - Test metadata (stored as JSON string).
  * `description` (string) - Test description.
  * `package_name` (string) - Package name of the test.
  * `path` (string) - Short path of the test file.
  * `original_path` (string) - Full path of the test file.
  * `depends_on_macros` (string) - The macros the test directly depends on (stored as JSON array string).
  * `depends_on_nodes` (string) - The nodes the test directly depends on (stored as JSON array string).
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_sources

*Table*

Metadata about the sources configured in the project and project packages.
Each row contains information about the properties of a single source, including columns like tags, owner, freshness
configuration, database and schema.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the source.
  * `source_name` (string) - The name of the source.
  * `name` (string) - The name of the source table.
  * `identifier` (string) - The identifier of the source table.
  * `database_name` (string) - The source database name.
  * `schema_name` (string) - The source schema name.
  * `relation_name` (string) - Full relation name (database.schema.table).
  * `loaded_at_field` (string) - Field used for freshness checks.
  * `freshness_warn_after` (string) - Freshness warning threshold.
  * `freshness_error_after` (string) - Freshness error threshold.
  * `freshness_filter` (string) - Filter expression for freshness checks.
  * `tags` (string) - Source tags (stored as JSON array string).
  * `meta` (string) - Source metadata (stored as JSON string).
  * `owner` (string) - Source owner (configured under 'meta' key).
  * `description` (string) - Source description.
  * `source_description` (string) - Description of the source itself.
  * `package_name` (string) - Package name of the source.
  * `path` (string) - Short path of the source file.
  * `original_path` (string) - Full path of the source file.
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_exposures

*Table*

Metadata about the exposures configured in the project and project packages.
Each row contains information about the properties of a single exposure, including columns like tags, owner, url and
depends on.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the exposure.
  * `name` (string) - Exposure name.
  * `type` (string) - Exposure type (e.g., dashboard, notebook, application).
  * `maturity` (string) - Exposure maturity level.
  * `url` (string) - URL of the exposure.
  * `owner_email` (string) - Email of the exposure owner.
  * `owner_name` (string) - Name of the exposure owner.
  * `description` (string) - Exposure description.
  * `tags` (string) - Exposure tags (stored as JSON array string).
  * `meta` (string) - Exposure metadata (stored as JSON string).
  * `package_name` (string) - Package name of the exposure.
  * `path` (string) - Short path of the exposure file.
  * `original_path` (string) - Full path of the exposure file.
  * `depends_on_macros` (string) - The macros the exposure directly depends on (stored as JSON array string).
  * `depends_on_nodes` (string) - The nodes the exposure directly depends on (stored as JSON array string).
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_metrics

*Table*

Metadata about the metrics configured in the project and project packages.
Each row contains information about the properties of a single metric, including columns like tags, owner, sql, and
depends on.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the metric.
  * `name` (string) - Metric name.
  * `label` (string) - Metric label.
  * `model` (string) - The model this metric is based on.
  * `type` (string) - Metric type (e.g., simple, derived).
  * `sql` (string) - SQL expression for the metric.
  * `timestamp` (string) - Timestamp column for the metric.
  * `filters` (string) - Metric filters (stored as JSON string).
  * `time_grains` (string) - Time grains for the metric (stored as JSON array string).
  * `dimensions` (string) - Metric dimensions (stored as JSON array string).
  * `description` (string) - Metric description.
  * `tags` (string) - Metric tags (stored as JSON array string).
  * `meta` (string) - Metric metadata (stored as JSON string).
  * `package_name` (string) - Package name of the metric.
  * `path` (string) - Short path of the metric file.
  * `original_path` (string) - Full path of the metric file.
  * `depends_on_macros` (string) - The macros the metric directly depends on (stored as JSON array string).
  * `depends_on_nodes` (string) - The nodes the metric directly depends on (stored as JSON array string).
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_snapshots

*Table*

Metadata about all the snapshots in the project and project packages.
Each row contains information about the properties of a single snapshot, including columns like tags, owner, depends\_on,
and description.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the snapshot.
  * `name` (string) - Snapshot name.
  * `alias` (string) - Snapshot alias.
  * `database_name` (string) - The snapshot database name.
  * `schema_name` (string) - The snapshot schema name.
  * `materialization` (string) - The snapshot materialization config.
  * `tags` (string) - Snapshot tags (stored as JSON array string).
  * `meta` (string) - Snapshot metadata (stored as JSON string).
  * `owner` (string) - Snapshot owner (configured under 'meta' key).
  * `description` (string) - Snapshot description.
  * `package_name` (string) - Package name of the snapshot.
  * `path` (string) - Short path of the snapshot file.
  * `original_path` (string) - Full path of the snapshot file.
  * `checksum` (string) - Snapshot file checksum.
  * `depends_on_macros` (string) - The macros the snapshot directly depends on (stored as JSON array string).
  * `depends_on_nodes` (string) - The nodes the snapshot directly depends on (stored as JSON array string).
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_seeds

*Table*

Metadata about seed files in the dbt project and project packages.
Each row contains information about the properties of a single seed, including columns like tags, owner, database, schema, and description.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the seed.
  * `name` (string) - Seed name.
  * `alias` (string) - Seed alias.
  * `database_name` (string) - The seed database name.
  * `schema_name` (string) - The seed schema name.
  * `tags` (string) - Seed tags (stored as JSON array string).
  * `meta` (string) - Seed metadata (stored as JSON string).
  * `owner` (string) - Seed owner (configured under 'meta' key).
  * `description` (string) - Seed description.
  * `package_name` (string) - Package name of the seed.
  * `path` (string) - Short path of the seed file.
  * `original_path` (string) - Full path of the seed file.
  * `checksum` (string) - Seed file checksum.
  * `group_name` (string) - Group name if the seed belongs to a group.
  * `metadata_hash` (string) - Hash of the metadata for change detection.
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_columns

*Table*

Stores detailed information about columns across the dbt project.
Each row contains information about a single column from a model, source, or snapshot.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the column (format: `column.{parent_unique_id}.{column_name}`).
  * `parent_unique_id` (string) - The unique id of the parent table (model, source, or snapshot).
  * `name` (string) - Column name.
  * `data_type` (string) - Column data type.
  * `database_name` (string) - The database name of the parent table.
  * `schema_name` (string) - The schema name of the parent table.
  * `table_name` (string) - The table name (alias) of the parent table.
  * `resource_type` (string) - Type of the parent resource (model, source, snapshot).
  * `description` (string) - Column description.
  * `tags` (string) - Column tags (stored as JSON array string).
  * `meta` (string) - Column metadata (stored as JSON string).
  * `metadata_hash` (string) - Hash of the metadata for change detection.
  * `generated_at` (string) - Update time of the table.
</Accordion>

### dbt\_groups

*Table*

Metadata about the groups configured in the project and project packages.
Each row contains information about the properties of a single group, including columns like group name and owner.

<Accordion title="Key Columns">
  * `unique_id` (string) - The unique id of the group.
  * `name` (string) - Group name.
  * `owner` (string) - Group owner.
  * `package_name` (string) - Package name of the group.
  * `path` (string) - Short path of the group file.
  * `original_path` (string) - Full path of the group file.
  * `generated_at` (string) - Update time of the table.
</Accordion>

## Alerts views

### alerts\_dbt\_models

*View*

A view that is used by the Elementary CLI to generate models alerts, including all the fields the alert will include
such as owner, tags, error message, etc.
It joins data about models and snapshots run results, and filters alerts according to configuration.

### alerts\_dbt\_tests

*View*

A view that is used by the Elementary CLI to generate dbt tests alerts, including all the fields the alert will include
such as owner, tags, error message, etc.
This view includes data about all dbt tests except elementary tests.
It filters alerts according to configuration.

### alerts\_anomaly\_detection

*View*

A view that is used by the Elementary CLI to generate alerts on data anomalies detected using the elementary anomaly
detection tests.
The view filters alerts according to configuration.

### alerts\_schema\_changes

*View*

A view that is used by the Elementary CLI to generate alerts on schema changes detected using elementary tests.
The view filters alerts according to configuration.

## Anomaly detection

### data\_monitoring\_metrics

*Incremental model*

Elementary anomaly detection tests monitor metrics such as volume, freshness and data quality metrics.
This incremental table is used to store the metrics over time.
On each anomaly detection test, the test queries this table for historical metrics, and compares to the latest values.
The table is updated with new metrics on the on-run-end named `handle_test_results` that is executed at the end of dbt
test invocations.

### metrics\_anomaly\_score

*View*

This is a view on `data_monitoring_metrics` that runs the same query the anomaly detection tests run to calculate
anomaly scores.
The purpose of this view is to provide visibility to the results of anomaly detection tests.

### anomaly\_threshold\_sensitivity

*View*

This is a view on `metrics_anomaly_score` that calculates if values of metrics from the latest runs would have been
considered anomalies in different anomaly scores.
This can help you decide if there is a need to adjust the `anomaly_score_threshold`.

### monitors\_runs

*View*

This is a view on `data_monitoring_metrics` that is used to determine when a specific anomaly detection test was last
executed.
Each anomaly detection test queries this view to decide on a start time for collecting metrics.

## Schema changes

### schema\_columns\_snapshot

*Incremental model*

Stores the schema details for tables that are monitored with elementary schema changes test.
In order to compare current schema to previous state, we must store the previous state.
The data is from a view that queries the data warehouse information schema.
