forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RisingWave support (getredash#6776)
- Loading branch information
1 parent
11794b3
commit 34723e2
Showing
4 changed files
with
47 additions
and
0 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from redash.query_runner import register | ||
from redash.query_runner.pg import PostgreSQL | ||
|
||
|
||
class RisingWave(PostgreSQL): | ||
@classmethod | ||
def type(cls): | ||
return "risingwave" | ||
|
||
@classmethod | ||
def name(cls): | ||
return "RisingWave" | ||
|
||
def _get_tables(self, schema): | ||
query = """ | ||
SELECT s.nspname as table_schema, | ||
c.relname as table_name, | ||
a.attname as column_name, | ||
null as data_type | ||
FROM pg_class c | ||
JOIN pg_namespace s | ||
ON c.relnamespace = s.oid | ||
AND s.nspname NOT IN ('pg_catalog', 'information_schema', 'rw_catalog') | ||
JOIN pg_attribute a | ||
ON a.attrelid = c.oid | ||
AND a.attnum > 0 | ||
AND NOT a.attisdropped | ||
WHERE c.relkind IN ('m', 'f', 'p') | ||
UNION | ||
SELECT table_schema, | ||
table_name, | ||
column_name, | ||
data_type | ||
FROM information_schema.columns | ||
WHERE table_schema NOT IN ('pg_catalog', 'information_schema', 'rw_catalog'); | ||
""" | ||
|
||
self._get_definitions(schema, query) | ||
|
||
return list(schema.values()) | ||
|
||
|
||
register(RisingWave) |
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