Skip to content

[Bug] DatabricksExecutionError when store_failures creates table names > 255 characters #1309

@dhanesh-chua

Description

@dhanesh-chua

Describe the bug

When store_failures: true is enabled, dbt generates table names for test results by concatenating the test name, model name, and arguments. In our project, some deep schema tests generate names exceeding 255 characters.

Databricks (Unity Catalog/Hive Metastore) has a hard limit of 255 characters for table names. The dbt-databricks adapter currently attempts to create these tables without truncation or hashing, causing a runtime DatabricksExecutionError.

Steps To Reproduce

  1. Create a dbt model with a long name (e.g. finance_attribution_modeling_long_name_example).
  2. Add a generic test with verbose arguments (or a custom test with a long name).
  3. Enable store_failures: true in dbt_project.yml.
  4. Run dbt test.

Expected behavior

  • Hash or truncate the generated table name to fit within the 255-character limit (similar to how other adapters handle relation length limits).
  • Or fail at compile time with a clear error message, rather than a runtime SQL error.

Screenshots and log output

Database Error in test accepted_map_keys_stg_product_search_create_sizes__relax__boosted_spacing__after__limit__discounted__what__hashtag__not_id__seller_id__country__not_country__not_radius__created_after__ranking__free_national_shipping__discount_types__min_discount__max_discount__is_boosted__filters__modify_what__shipping_id__brands__categories__groups__product_types__condition__colours__variants__saved_variants__gender__is_kids__price_max__price_min__currency__is_discounted__rerank__from__filters_as_map_arrays (models/marts/core/search_queries/search_queries.yml)

[RequestId=812f1895-6374-4fff-ab57-7c5281e938a3 ErrorClass=INVALID_PARAMETER_VALUE] Invalid input: RPC CreateStagingTable Field managedcatalog.StagingTableInfo.name: name "accepted_map_keys_stg_product_search_create_sizes__relax__boosted_spacing__after__limit__discounted__what__hashtag__not_id__seller_id__country__not_country__not_radius__created_after__ranking__free_national_shipping__discount_types__min_discount__max_disc..." too long. Maximum length is 255 characters.
[2026-01-13, 04:04:43 UTC] {{pod_manager.py:381}} INFO - �[0m04:04:39

System information

The output of dbt --version:

Core:
  - installed: 1.10.9
  - latest:    1.11.2 - 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.10.10 - Update available!
  - spark:      1.9.2   - Update available!

  At least one plugin is out of date with dbt-core.
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

The operating system you're using:
MacOS Sequoia - Version 15.6.1 (24G90)

The output of python --version:
Python 3.12.10

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions