DBT-ANALYTICS-ENGINEERING practice question 1 of 35

What is the purpose of the --resource-type argument in the dbt ls command?

Full set: 409 questions

Domain dbt fundamentals

Answer options
A: Lists resources by configuration
B: Lists resources by materialization
C: Lists resources by tag
D: Lists resources of a specific type Correct answer
Correct Answer:
D. Lists resources of a specific type
Explanation

The dbt ls command is used to list resources within a dbt project. The --resource-type argument specifically filters this list to display only resources of a certain type. Valid resource types include model, test, source, seed, snapshot, exposure, metric, semanticmodel, savedquery, and analysis. For example, using dbt ls --resource-type model will list all models in the project, while dbt ls --resource-type test will list all tests. This argument provides a direct way to categorize and view specific kinds of project assets.

Why Incorrect

A. Incorrect. Selecting resources by specific configurations (e.g., materialized, schema) is done using the --select argument with the config: selector, not --resource-type.
B. Incorrect. While materialization is a configuration, it is selected using dbt ls --select config.materialized:, not the --resource-type argument.
C. Incorrect. Selecting resources by their assigned tags is accomplished using the --select argument with the tag: selector (e.g., dbt ls --select tag:nightly).

References

1. dbt Labs. (n.d.). dbt ls command. dbt Core documentation. Retrieved from https://docs.getdbt.com/reference/commands/ls.

Reference Details: The "Arguments" section explicitly lists --resource-type and describes its function: "Only list resources of the specified type." It also provides the list of valid resource types.

2. dbt Labs. (n.d.). Node selection syntax. dbt Core documentation. Retrieved from https://docs.getdbt.com/reference/node-selection/syntax.

Reference Details: This page details the various selection methods. It shows that selecting by tag and config (which includes materialization) are done using the --select flag

distinguishing them from the --resource-type flag's purpose.

Scroll to Top