Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gooddata-fdw/docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
14 changes: 14 additions & 0 deletions gooddata-fdw/sql/import_gooddata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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; $$;