INVALID_ARGUMENT Name xx not found when chaining SQL questions

Hello there :slight_smile:
I think I am definitively missing something with the SQL Question Editor of Metabase.
I am always ending with error like
400 Bad Request POST https://bigquery.googleapis.com/bigquery/v2/projects/xxx-infra/queries { "code": 400, "errors": [ { "domain": "global", "location": "q", "locationType": "parameter", "message": "Name XX not found inside source at [2:100]", "reason": "invalidQuery" } ], "message": "Name xxx not found inside source at [2:100]", "status": "INVALID_ARGUMENT" }
when trying to set up "simple" use cases with the SQL Editor.

When trying to understand what does not work using the SQL Editor view, it seems that the issue relies in the Metabase engine that translate the Question into SQL, which seems quite strange :thinking:

Here is a "simple" example:

  • I have a saved question named "Customers using feedback v2 - trackers with feedback information" that creates a custom column named has_feedback_received (based on an attribute named has_delivered_notification_opened)
  • I am then trying to create a question from this saved question using a count_if(has_feedback_received)
  • I get the error "Name has_delivered_notification_opened not found inside source"

If I checked the SQL generated I realize that the issue is the SQL generated: instead of using count_if(has_feedback_received) it used count_if(has_delivered_notification_opened) which does not exists :thinking:

I think I am missing something ?
How can I fix this ?

Here are my Diagnostic information
{
"browser-info": {
"language": "en-US",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"metabase-info": {
"databases": [
"bigquery-cloud-sdk",
"postgres"
],
"run-mode": "prod",
"plan-alias": "",
"version": {
"date": "2024-10-22",
"tag": "v0.50.31.1",
"hash": "d4b2302"
},
"settings": {
"report-timezone": null
},
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "14.13"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.7.3"
}
}
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.24+8",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.24",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.24+8",
"os.name": "Linux",
"os.version": "6.1.100+",
"user.language": "en",
"user.timezone": "GMT"
}
}

can you move to 51.4 and test if this is still there?

Hello :slight_smile:

I tried Metabase 51.4 and it is still there :frowning:

I nevertheless could dig a little bit and it may be linked to metadata field configuration on the model that I use a base for my question, but I do not understand what happens.

I opened an issue on github here: "field_ref" in metadata of a model leading to a "INVALID_ARGUMENT Name xx not found" error for BigQuery · Issue #50343 · metabase/metabase · GitHub

I will try to update this thread when I have some news.