Modify defn simple-select-probe-query

Hello,
I’m writing a Driver for the Informix Database
But the “Simple (ie. cheap) SELECT on a given table to test for access and get column metadata” defined in (defn simple-select-probe-query) causes Metabase to set all Tables in the Informix-Database to ‘inactive’ when synced.
This SQL should by default doesn’t return anything useful (only used to check whether we can execute a SELECT query).
A select as follows, gives out a respons.
SELECT * FROM kunde0 WHERE 1 <> 1 LIMIT 1
No rows found.
The predefined one from (defn simple-select-probe-query) returns an error.
SELECT true FROM kunde0 WHERE 1 <> 1 LIMIT 0;
201: A syntax error has occurred.
Error in line 1
Near character position 43

In the comments in (defn simple-select-probe-query) it says “but you can override this by passing clause-overrides.” How to do that?

This problem occurs because of the Mega sync performance improvements #13746.
see: https://github.com/metabase/metabase/pull/13746

Thanx for any answers.

{
  "browser-info": {
    "language": "de",
    "platform": "Linux x86_64",
    "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0",
    "vendor": ""
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "1.8.0_262-b10",
    "java.vendor": "Oracle Corporation",
    "java.vendor.url": "http://java.oracle.com/",
    "java.version": "1.8.0_262",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "25.262-b10",
    "os.name": "Linux",
    "os.version": "3.10.0-1062.18.1.el7.x86_64",
    "user.language": "de",
    "user.timezone": "Europe/Berlin"
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "ibminformix",
      "h2",
      "oracle"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "9.4.26"
      },
      "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": null
    }
  }
}

Hi @com
I’m not a driver developer, but I think this will put you on the right track.
Perhaps doing something like the Presto driver, but just creating your own overrides, since it seems like Informix behaves a little different than other databases, so that will ensure that you’re not having problems in the future. I don’t even know if Informix supports a privilege where you can see a table, but not select from it. If it doesn’t support that, then you can basically just return “true”, which will make it behave like before.
https://github.com/metabase/metabase/blob/1f6d5fa35a5e0f2e0a51bc0bfc077c5ccc2da309/modules/drivers/presto/src/metabase/driver/presto.clj#L230

Just for reference for others: Developing ibm informix driver - timezone problems

Hello,
I've updated the ibminformix.clj for the ibm informix driver, so it's working now. It's a crude solution, where the have-select-privilige is always answered with true, even when false. But it works.

2 Likes