Hi all, I have been trying to setup dbt and elemen...
# community-support
c
Hi all, I have been trying to setup dbt and elementary to execute tests on a database (read-only access), and store results into a data warehouse (read-write access). The following command runs successfully
Copy code
dbt clean
dbt deps  # to install elementary-data/elementary v0.15.1
dbt run --select elementary --profile elementary --target prod_data_warehouse  # schema and tables are created in data warehouse
With
dbt test
, while tests on source are successfully on the
on-run-end hook
I get
Missing Elementary models in 'None.'. Please run 'dbt run -s elementary --target prod_source'.
Copy code
...
04:29:19  Running 1 on-run-end hook
04:29:21  Missing Elementary models in 'None.'. Please run 'dbt run -s elementary --target prod_source'.
04:29:21  1 of 1 START hook: elementary.on-run-end.0 ..................................... [RUN]
04:29:21  1 of 1 OK hook: elementary.on-run-end.0 ........................................ [OK in 0.00s]
...
And I don’t know how to tell
dbt test
command to run elementary on a different profile
elementary
and target
prod_data_warehouse
, like the successful command above. What is the equivalent command that should run on on-run-end hook? I could execute it manually after dbt test? Any suggestion?
This is the profile.yml
Copy code
dbt_tests_source:
  outputs:
    prod_source:
      type: mysql5
      host: [HOST]
      password: [PASS]
      port: 3306
      threads: 4
      user: [USER]
  target: prod_source

elementary:
  outputs:
    prod_data_warehouse:
      type: "redshift"
      host: [HOST]
      port: 5439
      user: [USER]
      password: [PASS]
      dbname: "production"
      schema: "data_quality_dbt_source_aspireapp_elementary"
      threads: 10
  target: prod_data_warehouse
This is the dbt_project.yml
Copy code
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'dbt_tests_source_aspireapp'

# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets:         # directories to be removed by `dbt clean`
  - "target"
  - "dbt_packages"


# Configuring models
# Full documentation: <https://docs.getdbt.com/docs/configuring-models>

# In this example config, we tell dbt to build all models in the example/
# directory as views. These settings can be overridden in the individual model
# files using the `{{ config(...) }}` macro.
models:
  elementary:
    ## elementary models will be created in the schema '<your_schema>_elementary'
    # +schema: "elementary"
    ## To disable elementary for dev, uncomment this:
    # enabled: "{{ target.name in ['prod','analytics'] }}"

flags:
  require_explicit_package_overrides_for_builtin_materializations: True
  require_model_names_without_spaces: False
  source_freshness_run_project_hooks: False