MYSQL Date Time Last 15 Mins Issue no Data

Hi

Having problems with a query that works fine in MYSQL and worked in reedash that im moving from but not in Metabase.
I get no results when using this as the where clause to get data in last 15 minutes

where created BETWEEN (date_sub(now(),interval 10 minute)) AND NOW()

If i take this out i get data , what am i doing wrong here ?

Thanks

Hi @dazzer78
You mean data from the last 10 minutes. This is likely something to do with timezone, but you haven’t provided much details.
Please post “Diagnostic Info” from Admin > Troubleshooting.
And have a look at the troubleshooting guide:
https://www.metabase.com/docs/latest/troubleshooting-guide/timezones.html

Hi

Yes sorry 10 mins or any interval i add.
Mysql is in UTC time so will try changing that and try again

{
“browser-info”: {
“language”: “en-GB”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36”,
“vendor”: “Google Inc.”
},
“system-info”: {
“file.encoding”: “UTF-8”,
“java.runtime.name”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.7+10”,
“java.vendor”: “AdoptOpenJDK”,
“java.vendor.url”: “https://adoptopenjdk.net/”,
“java.version”: “11.0.7”,
“java.vm.name”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.7+10”,
“os.name”: “Linux”,
“os.version”: “5.4.0-39-generic”,
“user.language”: “en”,
“user.timezone”: “GMT”
},
“metabase-info”: {
“databases”: [
“h2”,
“mysql”
],
“hosting-env”: “unknown”,
“application-database”: “h2”,
“application-database-details”: {
“database”: {
“name”: “H2”,
“version”: “1.4.197 (2018-03-18)”
},
“jdbc-driver”: {
“name”: “H2 JDBC Driver”,
“version”: “1.4.197 (2018-03-18)”
}
},
“run-mode”: “prod”,
“version”: {
“date”: “2020-05-28”,
“tag”: “v0.35.4”,
“branch”: “release-0.35.x”,
“hash”: “b3080fa”
},
“settings”: {
“report-timezone”: “Europe/London”
}
}
}

Timezone was the issue , set Metabase to use default DB timezone and all good now

Thanks

1 Like

@dazzer78 Excellent. Remember to migrate away from H2, if you’re running Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html