Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python models to include a way to change the Python version #4244

Closed
1 task
runleonarun opened this issue Oct 10, 2023 · 5 comments
Closed
1 task
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear priority: medium Fix or enhancement to existing information that’s creating some requests from customers size: small This change will take 1 to 2 days to address

Comments

@runleonarun
Copy link
Collaborator

Contributions

  • I have read the contribution docs, and understand what's expected of me.

Link to the page on docs.getdbt.com requiring updates

https://docs.getdbt.com/docs/build/python-models

What part(s) of the page would you like to see updated?

If you want use a later version of Python in dbt than 3.8, you'd need to configure the version.

See this community thread in #dbt-core-python-model that explains how to set the py version in the dbt.config) in the model

def model(dbt, session):

    # setting configuration
    dbt.config(
      materialized="table",
        python_version="3.9"
)

Additional information

No response

@runleonarun runleonarun added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear labels Oct 10, 2023
@runleonarun
Copy link
Collaborator Author

@dbeatty10 or @joellabes Is there a specific way you'd recommend we document this or does the example above look ok? I was thinking about adding this information to the Specific data platforms section and the examples.

  1. Are there any differences between changing the version for Databricks vs BigQuery vs Snowflake?
  2. Is there a best practice for setting a different version?
  3. Any gotchas / Do we recommend against doing this?

thank you!

@runleonarun runleonarun added priority: medium Fix or enhancement to existing information that’s creating some requests from customers size: small This change will take 1 to 2 days to address labels Oct 10, 2023
@dbeatty10
Copy link
Contributor

@runleonarun I don't know if I can fully answer any of those questions 😅

After doing some very quick code searches, I didn't see the python_version config for any other adapters other than dbt-snowflake:

So it looks like that this example would only have any effect in dbt-snowflake:

def model(dbt, session):

    # setting configuration
    dbt.config(
      materialized="table",
        python_version="3.9"
)

For dbt-bigquery, it sounds like setting the PYSPARK_PYTHON environment variable is how to choose the default Python interpreter for your PySpark jobs, but that is not something I've tried out or verified personally.

@runleonarun
Copy link
Collaborator Author

Thanks so much for looking into this @dbeatty10! Sounds like we'll have to do some more research.

@xemiem
Copy link

xemiem commented Oct 19, 2023

Thanks for bringing this up @runleonarun! Looking forward to the docs being updated on this :)

@mirnawong1
Copy link
Contributor

documented here: https://docs.getdbt.com/docs/build/python-models#specific-data-platforms so closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear priority: medium Fix or enhancement to existing information that’s creating some requests from customers size: small This change will take 1 to 2 days to address
Projects
None yet
Development

No branches or pull requests

4 participants