Search code examples
influxdbpresto

How to create a custom connector for Presto and InfluxDB


I am trying to create a custom connector for Presto and InfluxDB in order to make it possible for Presto to run SQL queries on InfluxDB. Are there any examples of such a connector being available already?

Connectors are the source of all data for queries in Presto. Even if your data source doesn’t have underlying tables backing it, as long as you adapt your data source to the API expected by Presto, you can write queries against this data.

The only documentation that I found for writing a connector is: https://prestodb.io/docs/current/develop/example-http.html

If anyone has other examples, can you please share it?


Solution

  • There are multiple connectors in the presto source tree.

    When you're connecting to a data source having JDBC driver (probably not your case), extending presto-base-jdbc driver gives you almost all you need. See for example https://github.com/trinodb/trino/tree/master/presto-postgresql

    When you're connecting to a non-JDBC-enabled data source (or you need more that it's possible with presto-base-jdbc), you need to implement all the relevant connector interfaces. There isn't good documentation for this other than Java interfaces & source code, but you can follow examples e.g. https://github.com/trinodb/trino/tree/master/presto-cassandra, https://github.com/trinodb/trino/tree/master/presto-accumulo

    Yet another option is Greg Leclercq's suggestion to implement a Thrift connector. See his answer for directions.