Skip to content

dbt Classes Instance Methods is_string, is_numeric, is_number, is_float don't seem to work #1380

Closed

Description

@fivetran-catfritz

Describe the bug

The same issue with the methods persists in the Databricks adapter as was reported in the Spark adapter in this issue.

dbt Classes Instance Methods is_string, is_numeric, is_number, is_float don't seem to work

For our instance, col.is_string() does not works, and for one of our customers, the col.is_number() also does not work.

Steps To Reproduce

  • Take any string field output from get_columns_in_relation and print the result of col.is_string().

Expected behavior

  • When col.datatype == 'string' then col.is_string() should evaluate to true.

Screenshots and log output

  • I ran this print statement.
{{ print('Column: ' ~ col.name ~ ' | Data Type: ' ~ col.data_type ~ ' | Is Number: ' ~ col.is_number() ~ ' | Is String: ' ~ col.is_string()) }}

And the result shows it's not identifying correctly.

Column: name03 | Data Type: string | Is Number: False | Is String: False

System information

The output of dbt --version:

Core:
  - installed: 1.11.6
  - latest:    1.11.7 - Update available!

Plugins:
  - databricks: 1.11.6 - Up to date!

The operating system you're using:
macOS

The output of python --version:
Python 3.13.9

Additional context

Add any other context about the problem here.

Activity

  1. psaikaushik commented on Apr 12, 2026

    @psaikaushik
    Contributor

    I can pick this up. The same issue was reported in dbt-spark (#658) and the root cause is the same — the Column base class methods like is_string() check against type names that don't include Spark/Databricks types.

    Looking at the code, is_string() in the base Column class likely checks for types like text, character varying, etc. (PostgreSQL-style names), but Databricks returns string as the dtype. The fix is to override the string_type classmethod (or the equivalent type classification method) in the Databricks Column implementation to include string in the set of recognized string types.

    Same pattern for is_number() — Databricks uses int, bigint, double, etc. which may not all be in the base class's numeric type set.

    I'll look at the Column adapter class and send a PR.

  2. added a commit that references this issue on Apr 12, 2026
    b317432
  3. psaikaushik commented on Apr 12, 2026

    @psaikaushik
    Contributor

    PR up: #1390

    Overrides is_string(), is_number(), is_float(), is_integer(), and is_numeric() on DatabricksColumn with the full set of Spark/Databricks type names. The base Column class only knows PostgreSQL types, which is why these all returned False.

  4. self-assigned this
    on Apr 27, 2026
  5. github-actions commented on Oct 25, 2026

    @github-actions

    This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue.

  6. fivetran-catfritz commented on Oct 27, 2026

    @fivetran-catfritz
    Author

    Yes this should still be fixed. No more stale please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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