View a markdown version of this page

Use SHOW commands - Amazon Redshift

Amazon Redshift will no longer support the creation of new Python UDFs starting Patch 198. Existing Python UDFs will continue to function until June 30, 2026. For more information, see the blog post .

Use SHOW commands

If the driver metadata API doesn't cover your use case, you can use Amazon Redshift SHOW commands to retrieve metadata. SHOW commands are optimized for fast metadata retrieval. They're useful when you need metadata in an interactive SQL session, or when your application connects through a client that doesn't expose the driver metadata API.

The following SHOW commands are supported for common discovery operations:

Examples

SHOW SCHEMAS FROM DATABASE dev; database_name | schema_name | schema_owner | schema_type | schema_acl | source_database | schema_option ---------------+----------------------+--------------+-------------+-----------------------------+-----------------+--------------- dev | pg_automv | 1 | local | | | dev | pg_catalog | 1 | local | jpuser=UC/jpuser~=U/jpuser | | dev | public | 1 | local | jpuser=UC/jpuser~=UC/jpuser | | dev | information_schema | 1 | local | jpuser=UC/jpuser~=U/jpuser | | dev | schemad79cd6d93bf043 | 1 | local | | |
SHOW TABLES FROM SCHEMA dev.s1 LIKE '%view' LIMIT 1; database_name | schema_name | table_name | table_type | table_acl | remarks | owner | last_altered_time | last_modified_time | dist_style | table_subtype ---------------+-------------+-------------------+------------+--------------------------------------+---------+-------+-------------------+--------------------+------------+------------------- dev | s1 | late_binding_view | VIEW | {alice=arwdRxtDPA/alice,bob=d/alice} | | alice | | | | LATE BINDING VIEW
SHOW COLUMNS FROM TABLE second_db.public.t22; database_name | schema_name | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length | numeric_precision | numeric_scale | remarks | sort_key_type | sort_key | dist_key | encoding | collation ---------------+-------------+------------+-------------+------------------+----------------+-------------+-----------------------------+--------------------------+-------------------+---------------+---------+---------------+----------+----------+----------+----------- second_db | public | t22 | col1 | 1 | | YES | integer | | 32 | 0 | | INTERLEAVED | -1 | | mostly8 | second_db | public | t22 | col2 | 2 | | YES | character varying | 100 | | | | INTERLEAVED | 2 | | text255 | default second_db | public | t22 | col3 | 3 | | YES | timestamp without time zone | | | | | | 0 | | raw | second_db | public | t22 | col4 | 4 | | YES | numeric | | 10 | 2 | | | 0 | | az64 |

For more information, see SHOW in the Amazon Redshift Database Developer Guide.