I have created external schema and external table in Redshift. I'm able to see external schema name in postgresql using \dn.
What will be query to do it so that i can run it in java? and also the query to get list of external table?
I tried
select * from information_schema.tables where
table_schema not in ('pg_catalog', 'information_schema')
and table_schema not like 'pg_toast%'
but it didn't get the list of external tables.
In Amazon Redshift, we use the term schema. An Amazon Redshift external schema references an external database in an external data catalog. You can create the external database in Amazon Redshift, in Amazon Athena, in AWS Glue Data Catalog, or in an Apache Hive metastore, such as Amazon EMR.
Use SVV_EXTERNAL_TABLES to view details for external tables; for more information, see CREATE EXTERNAL SCHEMA. Use SVV_EXTERNAL_TABLES also for cross-database queries to view metadata on all tables on unconnected databases that users have access to. SVV_EXTERNAL_TABLES is visible to all users.
In order to list or show all of the tables in a Redshift database, you'll need to query the PG_TABLE_DEF systems table. An interesting thing to note is the PG_ prefix. This is because Redshift is based off Postgres, so that little prefix is a throwback to Redshift's Postgres origins.
External Schema/Level An external schema describes the part of the database which specific user is interested in. It hides the unrelated details of the database from the user. There may be “n” number of external views for each database.
Redshift Spectrum external databases, schemas, and tables have their own catalog views.
You can query these from any connection: SELECT * FROM svv_external_schemas;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With