This PostgreSQL extension is a Foreign Data Wrapper (FDW) for InfluxDB.
The current version can work with PostgreSQL 9.6 and 10.
Install InfluxDB Go client library
go get github.com/influxdata/influxdb/client/v2
Add a directory of pg_config to PATH and build and install influxdb_fdw.
make USE_PGXS=1 make install USE_PGXS=1
If you want to build influxdb_fdw in a source tree of PostgreSQL instead, use
make make install
CREATE EXTENSION influxdb_fdw;
CREATE SERVER influxdb_server FOREIGN DATA WRAPPER influxdb_fdw OPTIONS (dbname 'mydb', host 'http://localhost', port '8086') ;
CREATE USER MAPPING FOR CURRENT_USER SERVER influxdb_server OPTIONS(user 'user', password 'pass');
You need to declare a column named "time" to access InfluxDB time column.
CREATE FOREIGN TABLE t1(time timestamp with time zone , tag1 text, field1 integer) SERVER influxdb_server OPTIONS (table 'measurement1');
IMPORT FOREIGN SCHEMA public FROM SERVER influxdb_server INTO public;
SELECT * FROM t1;
- Only SELECT queries are supported.
- WHERE clauses are not pushed down to InfluxDB in current version.
Copyright (c) 2018, TOSHIBA Corporation Copyright (c) 2011 - 2016, EnterpriseDB Corporation
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
See the LICENSE
file for full details.