Skip to content

Commit

Permalink
Missing queries for postgesql and Oracle for the 'sre' proc.
Browse files Browse the repository at this point in the history
  • Loading branch information
dstreev committed Jun 15, 2023
1 parent 2eb79fa commit 7875ff2
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>com.cloudera.utils.hive</groupId>
<artifactId>hive-sre</artifactId>
<version>2.5.1.3</version>
<version>2.5.1.4</version>

<name>hive-sre</name>

Expand Down
87 changes: 87 additions & 0 deletions src/main/resources/sre/ORACLE/hive_sre_queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,49 @@ query_definitions:
statement: "
SELECT COUNT(*) as count FROM FUNCS
"
tbl_part_locations:
statement: "SELECT DISTINCT
D.NAME ,
T.TBL_NAME ,
T.TBL_TYPE ,
P.PART_NAME ,
CASE
WHEN PS.LOCATION IS NULL
THEN S.LOCATION
ELSE PS.LOCATION
END AS PATH_LOCATION
FROM
DBS D
INNER JOIN
TBLS T
ON
D.DB_ID = T.DB_ID
LEFT OUTER JOIN
SDS S
ON
T.SD_ID = S.SD_ID
LEFT OUTER JOIN
TABLE_PARAMS PARAMS
ON
T.TBL_ID = PARAMS.TBL_ID
LEFT OUTER JOIN
PARTITIONS P
ON
T.TBL_ID = P.TBL_ID
LEFT OUTER JOIN
SDS PS
ON
P.SD_ID = PS.SD_ID
WHERE
D.NAME LIKE ?
AND D.NAME != 'sys'
AND T.TBL_TYPE != 'VIRTUAL_VIEW'
ORDER BY D.NAME, T.TBL_NAME"
parameters:
dbs:
initial: "%"
sqlType: 12
location: 1
db_tbl_count:
statement: "SELECT
name,
Expand All @@ -293,6 +336,50 @@ query_definitions:
initial: "%"
sqlType: 12
location: 1
managed_tbl_locations:
statement: "SELECT DISTINCT
D.NAME ,
T.TBL_NAME ,
T.TBL_TYPE ,
P.PART_NAME ,
CASE
WHEN PS.LOCATION IS NULL
THEN S.LOCATION
ELSE PS.LOCATION
END AS PATH_LOCATION
FROM
DBS D
INNER JOIN
TBLS T
ON
D.DB_ID = T.DB_ID
LEFT OUTER JOIN
SDS S
ON
T.SD_ID = S.SD_ID
LEFT OUTER JOIN
TABLE_PARAMS PARAMS
ON
T.TBL_ID = PARAMS.TBL_ID
LEFT OUTER JOIN
PARTITIONS P
ON
T.TBL_ID = P.TBL_ID
LEFT OUTER JOIN
SDS PS
ON
P.SD_ID = PS.SD_ID
WHERE
D.NAME LIKE ?
AND T.TBL_TYPE = 'MANAGED_TABLE'
AND PARAMS.PARAM_KEY = 'transactional'
AND LOWER(PARAMS.PARAM_VALUE) = 'true'
ORDER BY D.NAME, T.TBL_NAME"
parameters:
dbs:
initial: "%"
sqlType: 12
location: 1
acid_table_list:
statement: "
SELECT
Expand Down
90 changes: 90 additions & 0 deletions src/main/resources/sre/POSTGRES/hive_sre_queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,50 @@ query_definitions:
statement: "
SELECT \"TBL_TYPE\", COUNT(*) as count FROM \"TBLS\" GROUP BY \"TBL_TYPE\"
"
tbl_part_locations:
statement: "SELECT DISTINCT
\"D\".\"NAME\",
\"T\".\"TBL_NAME\",
\"T\".\"TBL_TYPE\",
\"P\".\"PART_NAME\",
CASE
WHEN \"PS\".\"LOCATION\" IS NULL
THEN \"S\".\"LOCATION\"
ELSE \"PS\".\"LOCATION\"
END AS \"PATH_LOCATION\"
FROM
\"DBS\" \"D\"
INNER JOIN
\"TBLS\" \"T\"
ON
\"D\".\"DB_ID\" = \"T\".\"DB_ID\"
LEFT OUTER JOIN
\"SDS\" \"S\"
ON
\"T\".\"SD_ID\" = \"S\".\"SD_ID\"
LEFT OUTER JOIN
\"TABLE_PARAMS\" \"PARAMS\"
ON
\"T\".\"TBL_ID\" = \"PARAMS\".\"TBL_ID\"
LEFT OUTER JOIN
\"PARTITIONS\" \"P\"
ON
\"T\".\"TBL_ID\" = \"P\".\"TBL_ID\"
LEFT OUTER JOIN
\"SDS\" \"PS\"
ON
\"P\".\"SD_ID\" = \"PS\".\"SD_ID\"
WHERE
\"D\".\"NAME\" LIKE ?
AND \"D\".\"NAME\" != 'sys'
AND \"T\".\"TBL_TYPE\" != 'VIRTUAL_VIEW'
ORDER BY
\"D\".\"NAME\", \"T\".\"TBL_NAME\""
parameters:
dbs:
initial: "%"
sqlType: 12
location: 1
dbs_table_type_count:
statement: "
SELECT
Expand Down Expand Up @@ -296,6 +340,52 @@ FROM
initial: "%"
sqlType: 12
location: 1
managed_tbl_locations:
statement: "SELECT DISTINCT
\"D\".\"NAME\"
, \"T\".\"TBL_NAME\"
, \"T\".\"TBL_TYPE\"
, \"P\".\"PART_NAME\"
, CASE
WHEN \"PS\".\"LOCATION\" IS NULL
THEN \"S\".\"LOCATION\"
ELSE \"PS\".\"LOCATION\"
END AS PATH_LOCATION
FROM
\"DBS\" \"D\"
INNER JOIN
\"TBLS\" \"T\"
ON
\"D\".\"DB_ID\" = \"T\".\"DB_ID\"
LEFT OUTER JOIN
\"SDS\" \"S\"
ON
\"T\".\"SD_ID\" = \"S\".\"SD_ID\"
LEFT OUTER JOIN
\"TABLE_PARAMS\" \"PARAMS\"
ON
\"T\".\"TBL_ID\" = \"PARAMS\".\"TBL_ID\"
LEFT OUTER JOIN
\"PARTITIONS\" \"P\"
ON
\"T\".\"TBL_ID\" = \"P\".\"TBL_ID\"
LEFT OUTER JOIN
\"SDS\" \"PS\"
ON
\"P\".\"SD_ID\" = \"PS\".\"SD_ID\"
WHERE
\"D\".\"NAME\" LIKE ?
AND \"T\".\"TBL_TYPE\" = 'MANAGED_TABLE'
AND \"PARAMS\".\"PARAM_KEY\" = 'transactional'
AND LOWER(\"PARAMS\".\"PARAM_VALUE\") = 'true'
ORDER BY
\"D\".\"NAME\"
, \"T\".\"TBL_NAME\""
parameters:
dbs:
initial: "%"
sqlType: 12
location: 1
acid_table_list:
statement: "
SELECT
Expand Down

0 comments on commit 7875ff2

Please sign in to comment.