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
SELECT c.relname AS "Name", | |
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS "Engine", | |
pg_relation_size(c.oid) AS "Data_length", | |
pg_total_relation_size(c.oid) - pg_relation_size(c.oid) AS "Index_length", | |
obj_description(c.oid, 'pg_class') AS "Comment", | |
CASE WHEN c.relhasoids THEN 'oid' ELSE '' END AS "Oid", | |
c.reltuples as "Rows", | |
n.nspname | |
FROM pg_class c | |
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace) |
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
from typing import Any, Dict, Optional | |
def get_first(d: Dict[Any, Any], *keys: Any) -> Optional[Any]: | |
"""Return the first value from d that is not None utilizing the *keys as key lookups. | |
If no value can be found for any key, returns None. | |
Example: | |
>>> d = { | |
'tesT': 1, | |
'TeST': 2, |
OlderNewer