Skip to content

Can we add additional table to existing Redshift external schema

0

I have a redshift external schema named example_ext_schema pointing to Glue data catalog. I would like to add an additional table to the "example_ext_schema", can I add it ?

asked 2 years ago540 views

1 Answer
0

Yes, you can add additional tables to an existing Redshift external schema that points to a Glue data catalog. There are two main ways to do this:

  1. If the table already exists in the AWS Glue Data Catalog: In this case, you don't need to create the table using CREATE EXTERNAL TABLE. Once you've created the external schema that references the Glue catalog, you can directly query the table using the schema name and table name. Redshift will automatically recognize the table from the Glue catalog.

  2. If you want to create a new external table: You can use the CREATE EXTERNAL TABLE command to add a new table to your existing external schema. The syntax would be similar to:

CREATE EXTERNAL TABLE example_ext_schema.new_table_name ( column1 datatype, column2 datatype, ... ) LOCATION 's3://your-bucket/path-to-data/' FORMAT file_format;

Remember that to create external tables, you must have the necessary permissions. You need to be the owner of the external schema or a superuser. Also, ensure that your IAM role has the appropriate permissions to access the S3 data and interact with the Glue catalog.

After adding the table, you can use it in your queries just like any other table in your Redshift cluster, with the added benefit of being able to query data directly from S3 without loading it into Redshift.
Sources
CREATE EXTERNAL TABLE - Amazon Redshift
External tables for Redshift Spectrum - Amazon Redshift

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.