Skip to content

R binds Snowflake semantic view variables without their declared type #447

Open

Description

@jat255

R can't call a Snowflake semantic view that declares a variable, at least with Snowflake ODBC driver 4.x. snowflake_semantic_metric_sql() writes VARIABLES "MIN_TOTAL" => ? and binds the value. The driver binds it as text, and Snowflake requires a variable's value to match the declared type: Expression's derived type 'VARCHAR(1)' does not match provided data type 'NUMBER(10,2)' for variable 'MIN_TOTAL'.

CAST(? AS NUMBER(10,2)) works. Casting to the type the view declares keeps the value exact. A looser cast such as CAST(? AS NUMBER) rounds 50.5 to 51.

Found by "live Snowflake binds native semantic variables" in #431. That run used driver 4.0.0 on macOS. CI on Linux uses a different driver install, so it may not fail there, but the cast is correct with either driver.

Activity

  1. added
    bugSomething isn't working
    rAffects the R implementation
    on Oct 22, 2026
  2. self-assigned this
    on Oct 22, 2026
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 workingrAffects the R implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions