Snowflake - incorrect results

Hi all, I'm a new user here, hence I am only allowed to post only 1 picture in my post, so I've combined all my 4 screenshots into 1, apologies. Also, I've been a daily Metabase user for my company for more than 6 months already, so I can say I am fairly experienced in it. However, this new problem that I am currently facing completely stumps me (and my fellow data colleague).

Just wanna say first that my data warehouse is Snowflake, and querying anything there seems fine. So the raw data should not be having any issue.

So, for example, SELECT * FROM TABLE1 yields me 18k entries on Snowflake, which is correct. However running this same query on MB (Native Query) yields me just 300 entries (top left of screenshot).

But it only gets worse/more mind-boggling from here. Querying different fields from the same table gives me DIFFERENT number of entries returned (without any WHERE filter being applied) (top right and bottom left of screenshot).

That is so weird! And this is just for TABLE1; all my other tables are having the same problem. The last weird issue is, doing a COUNT(*) query returns the CORRECT number of entries on Metabase (same as on Snowflake) (bottom right of screenshot)

My colleague and I have never seen such an error before.

Lastly, upon checking the Troubleshooting Logs, there is this error:
{:error-code "invalid_auth", :errors {:slack-token "Invalid token"}}

Not sure whether this error is causing this issue, though I wouldn't think so because an invalid Slack integration shouldn't be affecting the querying right?

Also, I am currently using the latest version of Metabase 0.37.3 (just updated it).

Would anyone care to help? Thanks a lot!

Hi @jophren
Please post “Diagnostic Info” from Admin > Troubleshooting.
So this only happens on Snowflake?
And it only happens since you upgrade - which version were you using previously?
If you add LIMIT 20000 to the query, does it then return the expected amount of rows?
Is it only specific tables, or any table on Snowflake?

Hi @flamber,

If you are asking whether running the query on Snowflake yields the same problem, no it does not; Snowflake churns out every query just fine. But running the query on Metabase’s “Ask a question” -> “Native Query” yields this problem. Thing is, even if I go to “Browse Data” and look at my tables, they are also returning much lesser entries than what is in the database.

Previously I was using version 0.37.2.

I just added the LIMIT 20000 line and interestingly, slightly more rows are returned, but still not the full table (but this increase is almost insignificant):

  1. SELECT * FROM TABLE1 returns 74 entries
  2. SELECT * FROM TABLE1 LIMIT 20000 returns 134 entries

This issue is occurring on all tables on Snowflake.

Diagostic Info:

  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "1.8.0_265-b01",
    "java.vendor": "Oracle Corporation",
    "java.vendor.url": "http://java.oracle.com/",
    "java.version": "1.8.0_265",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "25.265-b01",
    "os.name": "Linux",
    "os.version": "4.14.198-152.320.amzn2.x86_64",
    "user.language": "en",
    "user.timezone": "UTC"
  },
  "metabase-info": {
    "databases": [
      "snowflake",
      "googleanalytics"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "11.8"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.8"
      }
    },
    "run-mode": "prod",
    "version": {
      "tag": "v0.37.3",
      "date": "2020-12-03",
      "branch": "release-x.37.x",
      "hash": "2f1e783"
    },
    "settings": {
      "report-timezone": "Asia/Hong_Kong"
    }
  }
}```

@jophren
There hasn’t been any changes in that area between 0.37.2 and 0.37.3, so you weren’t having this problem before on 0.37.2? Have you tried to downgrade?
Given that two other people have just reported this today - LIMIT of Rows - on different versions, then I have a feeling that the problem is likely not in Metabase - otherwise it’s just crazy coincidence that three people report the same Snowflake problem the same day.

@jophren I have opened an issue, while this is being debugged:
https://github.com/metabase/metabase/issues/13995 - upvote by clicking :+1: on the first post

2 Likes

Thank you so much for the help!