Skip to main content

Running the dbt Core collector on-premise

Note

The latest version of the Collector is 2.248. To view the release notes for this version and all previous versions, please go here.

Generating the command or YAML file

This section walks you through the process of generating the command or YAML file for running the collector from Windows or Linux or MAC OS.

To generate the command or YAML file:

  1. On the Organization profile page, go to the Settings tab > Metadata collectors section.

  2. Click the Add a collector button.

    add_a_collector.png
  3. On the Choose metadata collector screen, select the correct metadata source. Click Next.

  4. On the Choose where the collector will run screen, in the On-premise section, select if you will be running the collector on Windows or Mac OS or Linux. This will determine the format of the YAML and CLI that is generated in the end. Click Next.

    select_an_os.png
  5. On the On-prem collector setup prerequisites screen, read the pre-requisites and click Next.

  6. On the Configure an on-premises dbt Core Collector screen, set the following properties and click Next.

  7. On the next screen, set the following properties and click Next.

    Table 2.

    Field name

    Corresponding parameter name

    Description

    Required?

    dbt artifact directory

    -d=<artifactDirectory>

    --artifact-directory=<artifactDirectory>

    The directory containing the dbt catalog.json, manifest.json, profiles.yml, dbt_project.yml,  and run_results.json.

    Without run_results.json, the emitted catalog will not contain activity information, but will otherwise be complete.

    Yes

    dbt run results directory

    --run-results-directory=<runResultsDirectory>

    Specify the directory containing multiple run results JSON files with *.json name pattern. A single run_results.json in the directory specified in --artifact-directory will be ignored.

    No

    dbt profile file path

    -P=<profileFile>

    --profile-file=<profileFile>

    The file containing profile definitions (defaults to dbt default of .dbt/profiles.yml in the user's home directory)

    No

    dbt profile

    -p=<profile>--profile=<profile>

    The dbt profile to use to obtain database location information (defaults to first profile found in profile definitions file)

    No

    dbt target

    -g=<target>

    --target=<target>

    The dbt profile target to use to obtain database location information (defaults to the profile's 'target' value)

    No



  8. On the next screen, first select the Target database. Options available are: PostgreSQL, Snowflake, Bigquery, Redshift. You would use these options to override the connection information from the dbt profile file or if the dbt profile file is not provided.

    For the PostgreSQL database, set the following properties and click Next.

    Table 3.

    Field name

    Corresponding parameter name

    Description

    Required?

    Database server

    --database-server=<databaseServer>

    The server/host for the target database.

    No

    Server port

    --database-port=<databasePort>

    The port for the target database.

    No

    Database

    --database=<database>

    The name of the target database.

    No

    Username

    --database-user=<databaseUser>

    The user credential to use while connecting to the target database.

    No

    Password

    --database-password=<databasePassword>

    The password credential to use in connecting to  the target database. Default value is environment variable ${DW_DBT_CORE_PASSWORD}.

    No



  9. If you selected the Target database as Snowflake, set the following properties and click Next.

    Table 4.

    Field name

    Corresponding parameter name

    Description

    Required?

    Database server

    --database-server=<databaseserver>

    The hostname of the database server to connect to.

    No

    Databse port

    -p=<port>

    --port=<port>

    The port of the database server (if not the default).

    No

    Authentication

    Select from one of the following options:

    • Authenticate with a username & password

    • Authenticate using a private key file

    Yes

    (parameters for atleast one authentication method must be set)

     

     

    Authenticate with a username & password

    Username

    --database-user=<databaseUser>

    The user credential to use while connecting to the target database.

    Password

    --database-password=<databasePassword>

    The password credential to use in connecting to  the target database. Default value is environment variable:  ${DW_DBT_CORE_PASSWORD}

    Authenticate using a private key file

    Database username

    --database-user=<databaseUser>

    Specify the username to use in connecting to the target database.

    Snowflake Private Key File

    --snowflake-private-key-file=<snowflakePrivateKey>

    The private key file to use for authentication with Snowflake (for example rsa_key.p8).

    Snowflake Key Password

    --snowflake-private-key-file-password=<snowflakePrivateKeyFilePassword>

    The password for the private key file to use for authentication with Snowflake, if the key is encrypted and a password was set. Set it as an environment variable ${DW_SNOWFLAKE_PK_PASSWORD}.

    Other optional parameters

    Snowflake Account

    --snowflake-account=<snowflakeAccount>

    The Snowflake account/tenant.

    You can use --database-server as an alternative.

    No

    Snowflake Application

    --snowflake-application=<snowflakeApplication>

    The application connection parameter to use in connecting to the target Snowflake database. Use datadotworld unless otherwise directed.

    No

    Snowflake Role

    ----snowflake-role=<snowflakeDatbaseRole> 

    The role to use in connecting to the target Snowflake database. This is case-insensitive.

    No

    Snowflake Warehouse

    --snowflake-warehouse=<snowflakeDatbaseWarehouse> 

    The warehouse to use in connecting to the target Snowflake database. This is case-insensitive.

    No



  10. If you selected the Target database as BigQuery, set the following property and click Next.

    Table 5.

    Field name

    Corresponding parameter name

    Description

    Required?

    BigQuery account credentials file path

    --bigquery-credentials-file=<bigqueryCredentialsFile>

    The file containing bigquery service account credentials. This applies only to models with bigquery references.

    If provided, the bigquery project ID is read from this file, otherwise the bigquery project in the profile file is used.

    No



  11. If you selected the Target database as RedShift, SQL Server, or Azure Synapse set the following properties and click Next.

    Table 6.

    Field name

    Corresponding parameter name

    Description

    Required?

    Database server

    --database-server=<databaseServer>

    The server/host for the target database.

    No

    Database port

    --database-port=<databasePort>

    The port for the target database.

    No

    Database

    --database=<database>

    The name of the target database.

    Yes

    Username

    --database-user=<databaseUsername>

    The user credential to use while connecting to the target database.

    Yes

    Password

    --database-password=<databasePassword>

    The password credential to use in connecting to  the target database. Default value is environment variable ${DW_DBT_CORE_PASSWORD}.

    Yes



  12. On the next screen, provide the Collector configuration name. This is the name used to save the configuration details. The configuration is saved and made available on the Metadata collectors summary page from where you can edit or delete the configuration at a later point. Click Save and Continue.

  13. On the Finalize your dbt Core Collector configuration screen, you are notified about the environment variables and directories you need to setup for running the collector. Select if you want to generate a Configuration file( YAML) or Command line arguments (CLI). Click Next.

    Important

    You must ensure that you have set up these environment variables and directories before you run the collector.

  14. The next screen gives you an option to download the YAML configuration file or copy the CLI command. Click Done. If you are generating a YAML file, click Next.

  15. The dbt Core command screen gives you the command to use for running the collector using the YAML file.

  16. You will notice that the YAML/CLI has following additional parameters that are automatically set for you.

    Important

    Except for the collector version, you should not change the values of any of the parameter listed here.

    Table 7.

    Parameter name

    Details

    Required?

    -a= <agent>

    --agent= <agent>

    --account= <agent>

    The ID for the data.world account into which you will load this catalog - this is used to generate the namespace for any URIs generated.

    Yes

    --site= <site>

    This parameter should be set only for Private instances. Do not set it for public instances and single-tenant installations. Required for private instance installations.

    Yes (required for private instance installations)

    -U

    --upload

    Whether to upload the generated catalog to the  organization account's catalogs dataset.

    Yes

    dwcc: <CollectorVersion>

    The version of the collector you want to use (For example, datadotworld/dwcc:2.168)

    Yes



  17. Add the following additional parameter to test run the collector.

    • --dry-run: If specified, the collector does not actually harvest any metadata, but just checks the connection parameters provided by the user and reports success or failure at connecting.

  18. We recommend enabling debug level logs when running the collector for the first time. This approach aids in swiftly troubleshooting any configuration and connection issues that might arise during collector runs. Add the following parameter to your collector command:

    • -e log_level=DEBUG: Enables debug level logging for collectors.

Verifying environment variables and directories

  1. Verify that you have set up all the required environment variables that were identified by the Collector Wizard before running the collector. Alternatively, you can set these credentials in a credential vault and use a script to retrieve those credentials.

  2. Verify that you have set up all the required directories that were identified by the Collector Wizard.

Running the collector

Important

Before you begin running the collector make sure you have completed all the pre-requisite tasks.

Running collector using YAML file

  1. Go to the machine where you have setup docker to run the collector.

  2. Place the YAML file generated from the Collector wizard to the correct directory.

  3. From the command line, run the command generated from the application for executing the YAML file.

    Caution

    Note that is just a sample command for showing the syntax. You must generate the command specific to your setup from the application UI.

    docker run -it --rm --mount type=bind,source=${HOME}/dwcc,target=/dwcc-output \
      --mount type=bind,source=${HOME}/dwcc,target=/app/log --mount type=bind,source=${HOME]/artifactDirectory,target=${HOME]/artifactDirectory \
      --mount type=bind,source=creds.json,target=creds.json -e DW_AUTH_TOKEN=${DW_AUTH_TOKEN} \
      datadotworld/dwcc:2.124 --config-file=/dwcc-output/config-dbt_core.yml
  4. If you are running the collector using Jar files, be sure to edit the command as instructed on this page.

  5. The collector automatically uploads the file to the specified dataset and you can also find the output at the location you specified while running the collector. Similarly, the log files are uploaded to the specified dataset and can be found in the directory mounted to target=/app/log specified in the command.

  6. If you decide in the future that you want to run the collector using an updated version, simply modify the collector version in the provided command. This will allow you to run the collector with the latest version.

Running collector without the YAML file

  1. Go to the machine where you have setup docker to run the collector.

  2. From the command line, run the command generated from the application. Here is a sample command. The following sample command is generated using BigQuery as the target database. Your command will vary based on the target database you select while generating the command.

    Caution

    Note that is just a sample command for showing the syntax. You must generate the command specific to your setup from the application UI.

    docker run -it --rm --mount type=bind,source=${HOME}/dwcc,target=/dwcc-output \
      --mount type=bind,source=${HOME}/dwcc,target=/app/log --mount type=bind,source=${HOME]/artifactDirectory,target=${HOME]/artifactDirectory \
      --mount type=bind,source=creds.json,target=creds.json datadotworld/dwcc:2.124 \
      catalog-dbt --agent=8bank-catalog-sources --site=solutions --no-log-upload=false \
      --upload=true --api-token=${DW_AUTH_TOKEN} --output=/dwcc-output \
      --name=8bank-catalog-sources-collection --upload-location=ddw-catalogs \
      --artifact-directory=${HOME]/artifactDirectory --bigquery-credentials-file=creds.json

    Warning

    If the command includes the --database_server parameter, make sure it is not followed by a trailing space (\).

  3. If you are running the collector using Jar files, be sure to edit the command as instructed on this page.

  4. The collector automatically uploads the file to the specified dataset and you can also find the output at the location you specified while running the collector. Similarly, the log files are uploaded to the specified dataset and can be found in the directory mounted to target=/app/log specified in the command.

  5. If you decide in the future that you want to run the collector using an updated version, simply modify the collector version in the provided command. This will allow you to run the collector with the latest version.

Collector runtime and troubleshooting

The catalog collector may run in several seconds to many minutes depending on the size and complexity of the system being crawled.

  • If the catalog collector runs without issues, you should see no output on the terminal, but a new file that matching *.dwec.ttl should be in the directory you specified for the output.

  • If there was an issue connecting or running the catalog collector, there will be either a stack trace or a *.log file. Both of those can be sent to support to investigate if the errors are not clear.

A list of common issues and problems encountered when running the collectors is available here.

Automating updates to your metadata catalog

Maintaining an up-to-date metadata catalog is crucial and can be achieved by employing Azure Pipelines, CircleCI, or any automation tool of your preference to execute the catalog collector regularly.

There are two primary strategies for setting up the collector run times:

  • Scheduled: You can configure the collector according to the anticipated frequency of metadata changes in your data source and the business need to access updated metadata. It's necessary to account for the completion time of the collector run (which depends on the size of the source) and the time required to load the collector's output into your catalog. This could be for instance daily or weekly. We recommend scheduling the collector run during off-peak times for optimal performance.

  • Event-triggered: If you have set up automations that refresh the data in a source technology, you can set up the collector to execute whenever the upstream jobs are completed successfully. For example, if you're using Airflow, Github actions, dbt, etc., you can configure the collector to automatically run and keep your catalog updated following modifications to your data sources.

Managing collector runs and configuration details