Skip to content

Instantly share code, notes, and snippets.

@Raidus
Created March 26, 2021 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raidus/a6d7fae190044e55acca707840c8143a to your computer and use it in GitHub Desktop.
Save Raidus/a6d7fae190044e55acca707840c8143a to your computer and use it in GitHub Desktop.
Query Tableau Extract via Postgres FDW #tableau #postgres

Good Reference Article

Setup Hyper API Server

  1. conda create --name tableau python=3.7
  2. conda activate tableau
  3. pip install tableauhyperapi
  4. /opt/anaconda3/envs/tableau/lib/python3.7/site-packages/tableauhyperapi/bin/hyper/hyperd run --init-user=tableau_internal_user --log-dir /Users/wilhelm/Downloads/ -d /Users/wilhelm/Downloads/many_cols.hyper --skip-license --no-password --listen-connection tab.tcp://0.0.0.0:7483 (NOTE: adjust PATHS for log dir and hyper extract)

Setup FDW in Postgres

CREATE SERVER hyper2 FOREIGN DATA WRAPPER postgres_fdw
    OPTIONS (host 'localhost', port '7483', dbname '/Users/wilhelm/Downloads/many_cols.hyper');
   
CREATE USER MAPPING FOR postgres SERVER hyper2 OPTIONS (user 'tableau_internal_user');

GRANT USAGE on FOREIGN DATA WRAPPER postgres_fdw to postgres;
GRANT USAGE ON FOREIGN SERVER hyper2 TO postgres;

IMPORT FOREIGN SCHEMA "Extract" FROM SERVER hyper2 INTO public;

SELECT id FROM "Extract" WHERE id=1000;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment