The information_schema in most database systems is very useful to get information about tables, views, columns that might be available in that db.
Here are the information schema views available. (WARNING: queries against the information_schema views are very slow)
Schemas:
SELECT
catalog_name, schema_name
FROM information_schema.schemata
Tables:
SELECT
table_catalog, table_schema, table_name, table_type
FROM information_schema.tables
Columns:
select
table_catalog, table_schema, table_name, column_name, data_type, is_nullable,
column_default, comment
from information_schema.columns
order by
table_catalog, table_schema, table_name, ordinal_position
Retrieved by looking at the PrestoDB test cases: presto/presto-product-tests/src/main/resources/sql-tests/testcases/system at 2ad67dcf000be86ebc5ff7732bbb9994c8e324a8 · prestodb/presto · GitHub
No comments:
Post a Comment