To query data from Glue Data Catalog through Redshift Spectrum, we need to create an external schema.
Since our goal is to query processed data, we create a schema pointing to the processed database.

First, we need to create a Glue Crawler for the processed S3 bucket.



CREATE EXTERNAL SCHEMA IF NOT EXISTS taxi_processed
FROM DATA CATALOG
DATABASE 'redshift_database'
IAM_ROLE 'arn:aws:iam::878796852481:role/service-role/AmazonRedshift-CommandsAccessRole-20260429T193922'
REGION 'us-east-2';


Check tables:
SELECT schemaname, tablename
FROM svv_external_tables
WHERE schemaname = 'taxi_processed';

If you encounter “column year duplicated” error, fix the Glue table schema.
Go to Glue console → Tables → processed_yellow_taxi_trip_data → Edit schema
Remove year and month from normal columns, keep them in Partition keys.

Then refresh Redshift metadata and query again.