-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sophiely <ly.sophie200@gmail.com>
- Loading branch information
Showing
4 changed files
with
96 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 31 additions & 21 deletions
52
api/src/main/resources/marquez/db/migration/R__3_Datasets_view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,33 @@ | ||
DROP VIEW IF EXISTS datasets_view; | ||
CREATE VIEW datasets_view | ||
AS | ||
CREATE VIEW datasets_view AS | ||
SELECT d.uuid, | ||
d.type, | ||
d.created_at, | ||
d.updated_at, | ||
d.namespace_uuid, | ||
d.source_uuid, | ||
d.name, | ||
array_agg(CAST((namespaces.name, symlinks.name) AS DATASET_NAME)) AS dataset_symlinks, | ||
d.physical_name, | ||
d.description, | ||
d.current_version_uuid, | ||
d.last_modified_at, | ||
d.namespace_name, | ||
d.source_name, | ||
d.is_deleted | ||
FROM datasets d | ||
JOIN dataset_symlinks symlinks ON d.uuid = symlinks.dataset_uuid | ||
INNER JOIN namespaces ON symlinks.namespace_uuid = namespaces.uuid | ||
WHERE d.is_hidden IS FALSE | ||
GROUP BY d.uuid; | ||
d.type, | ||
d.created_at, | ||
d.updated_at, | ||
CASE | ||
WHEN (d.namespace_name = namespaces.name AND d.name = symlinks.name) THEN d.namespace_uuid | ||
ELSE namespaces.uuid | ||
END | ||
AS namespace_uuid , | ||
d.source_uuid, | ||
CASE | ||
WHEN (d.namespace_name = namespaces.name and d.name = symlinks.name) THEN d.name | ||
ELSE symlinks.name | ||
END | ||
AS name, | ||
array(SELECT ROW(namespaces.name::character varying(255), symlinks.name::character varying(255))::dataset_name) AS dataset_symlinks, | ||
d.physical_name, | ||
d.description, | ||
d.current_version_uuid, | ||
d.last_modified_at, | ||
CASE | ||
WHEN (d.namespace_name = namespaces.name AND d.name = symlinks.name) THEN d.namespace_name | ||
ELSE namespaces.name | ||
END | ||
AS namespace_name, | ||
d.source_name, | ||
d.is_deleted | ||
FROM datasets d | ||
JOIN dataset_symlinks symlinks ON d.uuid = symlinks.dataset_uuid | ||
JOIN namespaces ON symlinks.namespace_uuid = namespaces.uuid | ||
WHERE d.is_hidden is false; |
33 changes: 0 additions & 33 deletions
33
api/src/main/resources/marquez/db/migration/V68__alter_datasets_view_to_keep_symlinks.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters