dbt-databricks icon indicating copy to clipboard operation
dbt-databricks copied to clipboard

Documentation on how to use serverless cluster environments with python models

Open luisscabral opened this issue 1 year ago • 2 comments

In order to run python models with custom dependencies in serverless clusters, it is recommended to use serverless environments.

This has been incorporated into the dbt-databricks adapter with PR #938. However, it is not easy to understand how to use the added configurations environment_key or environment_dependencies because there is no documentation to reflect it.

Could you update the dbt-databricks configurations docs to reflect the latest configs additions?

luisscabral avatar Jun 05 '25 15:06 luisscabral

@luisscabral Are these options working as expected for you? In my machine they seem to be ignored

Core:
  - installed: 1.9.8 
  - latest:    1.10.6 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - databricks: 1.9.7 - Update available!
  - spark:      1.9.3 - Up to date!
 b'{"error_code":"INVALID_PARAMETER_VALUE","message":"Job environment \'pymono\' used by task inner_notebook is not defined in field \'environments\'.","details":[{"@type":"type.googleapis.com/google.rpc.RequestInfo","request_id":"xxxxxx-d006-460f-aea3-Xxxxxx","serving_data":""}]}'

My model config is:

def model(dbt, session):
    dbt.config(
        submission_method="serverless_cluster",
        materialized="incremental",
        incremental_strategy="merge",
        merge_with_schema_evolution=True,
        full_refresh=False,
        liquid_clustered_by=["col1", "col2", "col3"],
        unique_key=["key1", "key2"],
        target_alias="target",
        source_alias="source",
        incremental_predicates=[
            'target.updated_at > CURRENT_DATE() - INTERVAL "30 day"'
        ],
        not_matched_condition='source.updated_at > CURRENT_DATE() - INTERVAL "30 day"',
        environment_key="pymono",
        environment_deps=["/Workspace/Shared/Libs/pymono-1.0.0-py3-none-any.whl"],
    )

Regards

rodrigorabioglio avatar Aug 01 '25 22:08 rodrigorabioglio

Did any of you get this to work? I get a similar error as @rodrigorabioglio

ikhudur avatar Sep 12 '25 15:09 ikhudur