Update the ingest_s3_to_teradata() operation to use the AUTHORIZATION object:
@op(required_resource_keys={"teradata", "s3"})
def ingest_s3_to_teradata(context, status):
try:
if status == "Tables Dropped":
context.resources.teradata.s3_to_teradata(
s3_resource_instance,
os.getenv("AWS_S3_LOCATION"),
"people",
public_bucket=False, # Private bucket
teradata_authorization_name="s3_private_access" # Reference the AUTHORIZATION object
)
context.log.info("Data ingested successfully from S3 to Teradata")
return "Data Ingested"
else:
raise DagsterError("Tables not dropped")
except Exception as e:
context.log.error(f"Failed to ingest data: {e}")
raise