Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 299
user Avatar asked Jan 04 '23 02:01

user


2 Answers

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.

like image 162
Piotr Findeisen Avatar answered Jan 13 '23 13:01

Piotr Findeisen


Another option if you prefer to code in a programming language other than Java, is to implement a Thrift service and use the Thrift connector

like image 31
Greg Leclercq Avatar answered Jan 13 '23 15:01

Greg Leclercq