Skip to content

What's new in 0.41.0 for Metabase driver authors

Jeff Evans edited this page Oct 8, 2021 · 3 revisions

New Methods

  • metabase.driver/database-supports? has been added. Previously, the idea that a driver supports some feature was static. In order to support the notion of feature support being predicated on some attribute of the runtime database itself, we have added database-supports?. To give a concrete example: an older version of some database might not support regular expressions, but a newer one might (in which case, the database-supports? implementation can check whether the current server version is high enough). This method has almost the same signature as the previous supports? method except that the database is passed as an additional argument. See this issue for full context. The default implementation (provided by us), simply ignores the database and defers to calling supports?. Eventually, all invocations of supports? made within our code will be removed in favor of invocations to database-supports?, at which point we will remove the multimethod.

  • metabase.driver.sql.query-processor/escape-alias has been added. The idea behind this method is to provide drivers a way to "escape" any type of alias String (i.e. the name appearing right after the AS keyword in the generated query). Some databases don't allow certain characters in the alias, even when quoted, so this is to provide a mechanism to escape/translate such characters to make the alias name legal (see this issue for more context). The default implementation (provided by us, for :sql drivers) simply returns the String unchanged.

  • metabase.driver/normalize-db-details has been added as a way to perform more complex migrations of the db-details (i.e. the blob stored in the database containing all the connection information). It is invoked immediately after fetching the details from the application DB, before opening new connections using those details, or rendering the edit page (if opening a DB). The default implementation simply returns db-details unchanged.

  • metabase.driver/superseded-by has been added as a way to indicate some driver is deprecated by/superseded by a different one. It can be set by adding an superseded-by entry to the YAML file as shown here. To see how this flag affects the UI/UX of the database edit application, try creating a new Presto database in 0.41.

Deprecated Methods

Clone this wiki locally