Forum Discussion

crispybc's avatar
crispybc
Frequent Visitor
1 year ago
Solved

Preview Snowflake Connector Bug with boolean values

There seems to be a bug with the new preview Snowflake connector when retreiving BOOLEAN columns using native SQL query.  The values get returned as a string and when converting the column to a TRUE/...
  • OwenAuger's avatar
    1 year ago

    Hi crispybc - that does seem like a bug. I ran some tests out of curiosity and had exactly the same issue.

     

    I'm not sure what the best approach is while this bug exists, but here are some observations of variations on the query:

     

    1. Native query created using dialog box converts Boolean to text

    --  Boolean columns > text
    let
      Source = Value.NativeQuery(
        Snowflake.Databases("MY_SERVER.snowflakecomputing.com", "MY_WAREHOUSE", [Implementation = "2.0"]){
          [Name = "MY_DATABASE"]
        }[Data],
        "SELECT * FROM MY_SCHEMA.MY_VIEW",
        null,
        [EnableFolding = true]
      )
    in
      Source

    2. Setting EnableFolding = false fixes Boolean column type

    I would only recommend this if no further transformation steps a required in Power Query.

    --  Boolean columns > logical
    let
      Source = Value.NativeQuery(
        Snowflake.Databases("MY_SERVER.snowflakecomputing.com", "MY_WAREHOUSE", [Implementation = "2.0"]){
          [Name = "MY_DATABASE"]
        }[Data],
        "SELECT * FROM MY_SCHEMA.MY_VIEW",
        null,
        [EnableFolding = false]
      )
    in
      Source

    3. Setting Implementation ="1.0" (old connector) but keeping EnableFolding = true fixes also Boolean column type

    --  Boolean columns > logical
    let
      Source = Value.NativeQuery(
        Snowflake.Databases("MY_SERVER.snowflakecomputing.com", "MY_WAREHOUSE", [Implementation = "1.0"]){
          [Name = "MY_DATABASE"]
        }[Data],
        "SELECT * FROM MY_SCHEMA.MY_VIEW",
        null,
        [EnableFolding = true]
      )
    in
      Source