Date variables doesn't work

Hi,

When I give date variables value, the sql doesn't work.

[Cloudera][JDBC](11500) Given type does not match given object: 2021-09-01T00:00.

the variables look like below.

image

I cannot find any reason why it says type mismatch. I'm applying the variables to date type as well.

where to_timestamp(week_dt, 'yyyyMMdd') between [[trunc({{start_date}}, 'D') -- ]] trunc(current_timestamp() - interval 7 day, 'D')
and [[{{end_date}} -- ]] to_date(current_timestamp() - interval 1 day)

here is the whole sql script and diagnostic info.

select to_timestamp(week_dt, 'yyyyMMdd') as week_dt
, sum(uv) as uv
from dev_temp.tmp_push_report_1
where to_timestamp(week_dt, 'yyyyMMdd') between [[trunc({{start_date}}, 'D') -- ]] trunc(current_timestamp() - interval 7 day, 'D')
and [[{{end_date}} -- ]] to_date(current_timestamp() - interval 1 day)
[[and traffic_source = {{traffic_source}}]]
[[and sid = {{sid}}]]
group by week_dt
order by week_dt
{
  "browser-info": {
    "language": "ko-KR",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "1.8.0_192-b12",
    "java.vendor": "Oracle Corporation",
    "java.vendor.url": "http://java.oracle.com/",
    "java.version": "1.8.0_192",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "25.192-b12",
    "os.name": "Linux",
    "os.version": "2.6.32-696.10.1.el6.x86_64",
    "user.language": "ko",
    "user.timezone": "ROK"
  },
  "metabase-info": {
    "databases": [
      "impala",
      "athena"
    ],
    "hosting-env": "unknown",
    "application-database": "mysql",
    "application-database-details": {
      "database": {
        "name": "MySQL",
        "version": "5.7.31-log"
      },
      "jdbc-driver": {
        "name": "MariaDB Connector/J",
        "version": "2.6.2"
      }
    },
    "run-mode": "prod",
    "version": {
      "tag": "v0.38.2",
      "date": "2021-03-17",
      "branch": "release-x.38.x",
      "hash": "91f0ed6"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Hi @daniel.lee
I guess the problem is somewhere in the Impala driver, so check that you are using a version that matches the Metabase version. And check the driver repo for issues about this.

Hi, @flamber
I found the driver repo and looks there are correct impala driver.

image

still cannot find any reason for this problem.

@daniel.lee If you are referring to https://github.com/brenoae/metabase-impala-driver/ then the driver has not been updated for 1½ years.
https://github.com/brenoae/metabase-impala-driver/issues/7

@flamber

It seems the problem has not been solved yet right..?

@daniel.lee I guess so. Any problems that are specific to a driver should be reported in the driver repo.

@flamber

Thanks, then do you think not to use impala is the only way in my case?

@daniel.lee I don't know Impala, so I cannot help you.

Is this problem solved now?

@beta

As flamber said, it seems the problem is caused by driver, and it hasn't been solved yet.
So, we are just looking around for other ways not using Impala(e.g. Presto).

@daniel.lee The upcoming 0.41 will have a totally new PrestoDB driver. I don't know if that would help or not, but just thought I would mention it.

Will the impala driver also be updated?

@beta Metabase does not have an integrated Impala driver and will not get one in any near future.
https://github.com/metabase/metabase/issues/3002 - upvote by clicking :+1: on the first post

1 Like