connect icon indicating copy to clipboard operation
connect copied to clipboard

Add flightsql SQL driver

Open mkysel opened this issue 1 year ago • 3 comments

This is a small step in the Apache Arrow / FlightSQL direction. It is the minimal working improvement that is both easy and useful.

FlightSQL Driver: https://pkg.go.dev/github.com/apache/arrow/go/v14/arrow/flight/flightsql/driver#section-readme

I tested it against the new InfluxDBv3 which is flightsql/arrow compatible.

Docs for Influx here: https://www.influxdata.com/blog/two-methods-connecting-influxdb-3-0/

Example config:

input:
  sql_select:
    driver: flightsql
    dsn: flightsql://us-east-1-1.aws.cloud2.influxdata.com:443?bucket-name=get-started&tls=enabled&token=[token]
    table: census
    columns: [ '*' ]

I haven't yet figured out variable binding, but here are some breadcrumbs https://github.com/apache/arrow/pull/40311

mkysel avatar May 30 '24 23:05 mkysel

There might be benefit for a wider scope and potential if you target ADBC and then just use the FlightSQL driver for it.

That way it can be easily adapted to also allow using any of the ADBC drivers, such as snowflake, with minimal future changes.

Just an idea

zeroshade avatar Jun 05 '24 13:06 zeroshade

One of the hiccups with this implementation is that not all FlightSQL endpoints support variable/parameter bindings. Those that do, use different dialects that either use $ or ?.

There are no integration tests since I tested this against influxv3 which does not have a docker image yet. I suspect @zeroshade might have ideas on what the easiest integration test might be against.

mkysel avatar Jun 05 '24 15:06 mkysel

The open source Dremio docker image is likely the easiest integration test I can think of. Have a look at https://github.com/apache/arrow-adbc/blob/715fe2459a836527602383c50ecd40b8d520bb41/.github/workflows/integration.yml#L106 which is the CI workflow used for the flightsql integration testing for ADBC for examples of how to set it up.

zeroshade avatar Jun 07 '24 21:06 zeroshade

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jan 27 '25 14:01 CLAassistant