Skip to main content
You use foreign data wrappers (FDWs) to query external data sources from a . These external data sources can be one of the following:
  • Other s
  • databases outside of
If you are using peering, you can create FDWs in your Customer VPC to query a in your project. However, you can’t create FDWs in your s to query a data source in your Customer VPC. This is because peering uses AWS PrivateLink for increased security. See VPC peering documentation for additional details. FDWs are particularly useful if you manage multiple s with different capabilities, and need to seamlessly access and merge regular and time-series data.

Prerequisites

To follow the steps on this page:
  • Create a target with time-series and analytics enabled.

    You need your connection details. This procedure also works for .

Query another data source

To query another data source:
  • Tiger Cloud
  • Self-hosted TimescaleDB
You create FDWs with the postgres_fdw extension, which is enabled by default in .A user with the tsdbadmin role assigned already has the required USAGE permission to create FDWs. You can enable another user, without the tsdbadmin role assigned, to query foreign data. To do so, explicitly grant the permission. For example, for a new grafana user:
CREATE USER grafana;
       
GRANT grafana TO tsdbadmin;

CREATE SCHEMA fdw AUTHORIZATION grafana;

CREATE SERVER db1 FOREIGN DATA WRAPPER postgres_fdw 
OPTIONS (host '<host>', dbname 'tsdb', port '<port>');

CREATE USER MAPPING FOR grafana SERVER db1 
OPTIONS (user 'tsdbadmin', password '<password>');

GRANT USAGE ON FOREIGN SERVER db1 TO grafana;

SET ROLE grafana;

IMPORT FOREIGN SCHEMA public 
       FROM SERVER db1 
       INTO fdw;