Dbt: Threads cannot be set from an environment variable

Created on 25 May 2020  路  3Comments  路  Source: fishtown-analytics/dbt

Describe the bug

Threads cannot be configured with an environment variable.

Steps To Reproduce

Setting an environment variable "THREADS" with my profile set as
threads: "{{ env_var('THREADS') }}" throws the following error:

Encountered an error while reading profiles:
  ERROR Runtime Error
  at path ['threads']: '8' is not of type 'integer'

Expected behavior

In this example, I would have expected the run command to work with 8 threads.

System information

Which database are you using dbt with?

  • [x] postgres
  • [ ] redshift
  • [x] bigquery
  • [ ] snowflake
  • [ ] other (specify: ____________)

The output of dbt --version:

installed version: 0.15.2
latest version: 0.16.1

MacOs + Linux

The output of python --version:

Python 3.7.4

Additional context

This seems to work fine with ports but not for threads. It may also be an issue with other fields that expect integers like Timeouts / Retries in BigQuery profiles.

bug

Most helpful comment

Thanks for the writeup!

Could you try running this again using the latest release candidate of dbt v0.17.0? The new version includes a change (https://github.com/fishtown-analytics/dbt/pull/2357) that renders all YML files, including profiles.yml, within the native env. A Jinja expression that returns an integer should be able to pass an integer to the config.

All 3 comments

Thanks for the writeup!

Could you try running this again using the latest release candidate of dbt v0.17.0? The new version includes a change (https://github.com/fishtown-analytics/dbt/pull/2357) that renders all YML files, including profiles.yml, within the native env. A Jinja expression that returns an integer should be able to pass an integer to the config.

Sorry for the delay - I can confirm this works after upgrading to v0.17. It also fixed the variables for BigQuery profiles.

Thanks guys, I'll leave it to you to close this issue, it may suit you better to close when 0.17 moves out of RC.

thanks for the update @keiththompson!

Was this page helpful?
0 / 5 - 0 ratings