diff --git a/gooddata-fdw/docs/installation.rst b/gooddata-fdw/docs/installation.rst index f2ba7d6c4..ea0a107e3 100644 --- a/gooddata-fdw/docs/installation.rst +++ b/gooddata-fdw/docs/installation.rst @@ -23,7 +23,7 @@ Execute the following command in your repository root folder: .. code-block:: shell - docker-compose up -d + docker-compose up --build -d ``gooddata-fdw`` image is built from the Dockerfile and both services are started in background. diff --git a/gooddata-fdw/sql/import_gooddata.sql b/gooddata-fdw/sql/import_gooddata.sql index 2429d0972..c88f30080 100644 --- a/gooddata-fdw/sql/import_gooddata.sql +++ b/gooddata-fdw/sql/import_gooddata.sql @@ -21,6 +21,8 @@ CREATE OR REPLACE PROCEDURE import_gooddata( DECLARE sql_statement VARCHAR; foreign_schema VARCHAR := coalesce(foreign_schema, workspace); + foreign_table RECORD; + view_name VARCHAR; BEGIN -- Recreate schema, where foreign tables will be imported sql_statement := format('DROP SCHEMA IF EXISTS "%s" CASCADE', foreign_schema); @@ -35,4 +37,16 @@ BEGIN workspace, foreign_server, foreign_schema, object_type, numeric_max_size ); CALL execute_sql(sql_statement, debug); + + FOR foreign_table IN + SELECT table_name + FROM information_schema.tables + WHERE table_schema = foreign_schema AND table_type = 'FOREIGN' LOOP + view_name := foreign_table.table_name || '_view'; + sql_statement := format( + 'CREATE OR REPLACE VIEW "%s"."%s" AS SELECT * FROM "%s"."%s"', + workspace, view_name, workspace, foreign_table.table_name + ); + CALL execute_sql(sql_statement, debug); + END LOOP; END; $$;