Skip to content

AWS Glue Error Category: UNCLASSIFIED_ERROR; Failed Line Number: 177; An error occurred while calling o104.getDynamicFrame. empty.reduceLeft

0

I'm trying to connect to snowflake from AWS Glue. I've created a snowflake connection as stated in link below. https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-connect-snowflake-home.html.

I'm getting below error.

Error Category: UNCLASSIFIED_ERROR; Failed Line Number: 177; An error occurred while calling o104.getDynamicFrame. empty.reduceLeft

Below is my code

if __name__ == "__main__":
    
    Snowflake_node1729175857943 = glueContext.create_dynamic_frame.from_options(connection_type="snowflake", connection_options={"autopushdown": "on", "query": "select * from EDW.SCHEMA.TABLE", "connectionName": "Snowflake-dev-connection", "sfDatabase": "EDW"}, transformation_ctx="Snowflake_node1729175857943")

    dfred = Snowflake_node1729175857943.toDF().createOrReplaceTempView("table_df")
    sqlDF = spark.sql("SELECT COUNT(*) FROM table_df")
    sqlDF.show()
    job.commit()

asked 2 years ago666 views

2 Answers
0

The error you're encountering suggests there might be an issue with your connection to Snowflake or the data retrieval process. Here are a few things to check and try:

  1. Verify your Snowflake connection details:
  • Ensure the connection name "Snowflake-dev-connection" is correct and exists in your AWS Glue Data Catalog.
  • Double-check that the database name "EDW" is correct.
  • Confirm that the schema and table names in your query are accurate.
  1. Check permissions:
  • Make sure the IAM role associated with your Glue job has the necessary permissions to access the Snowflake connection and any required AWS resources.
  • Verify that the Snowflake user credentials stored in the connection have the proper access rights to the specified database, schema, and table.
  1. Network connectivity:
  • If you're using a VPC for your Glue job, ensure that the security groups and network ACLs allow outbound traffic to Snowflake.
  • If you're using PrivateLink for Snowflake, verify that the VPC endpoint is correctly set up and associated with your Glue job's VPC.
  1. Snowflake query:
  • Try simplifying your query to rule out any potential issues with the SQL statement. For example, you could try selecting a single column or limiting the number of rows.
  1. Error handling:
  • Implement try-catch blocks in your code to capture more detailed error messages that might provide additional insights into the problem.
  1. Glue job configuration:
  • Ensure you're using a compatible Glue version that supports the Snowflake connector.
  • Check if increasing the number of workers or the worker type helps resolve the issue.

If the problem persists after checking these points, you may want to enable more verbose logging in your Glue job to get more detailed error information. This can help pinpoint the exact cause of the failure and guide you towards a solution.
Sources
Unlock scalable analytics with a secure connectivity pattern in AWS Glue to read from or write to Snowflake | AWS Big Data Blog
Troubleshooting connection issues in AWS Glue - AWS Glue

answered 2 years ago

AWS
SUPPORT ENGINEER

reviewed 2 years ago

0

Hi ayrusv, Please check below answer on reduceLeft error. https://repost.aws/questions/QUDwx7TCwfRUO9DD1G1BbnUA/aws-glue-job-error-an-error-occurred-while-calling-o115-getdynamicframe-java-lang-unsupportedoperationexception-empty-reduceleft Validate username & password in the secrets manager. Also provide connectionName as an Additional network connection in Job Details section. And In Create connection make sure proper Network options & VPC provided.

AWS

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.