By using AWS re:Post, you agree to the AWS re:Post Terms of Use

I wanted to use Athena to query an example data lake from a YouTube tutorial but I keep getting this error

0

9ac739e1-b195-4194-b37b-8026a8edd901

COLUMN_NOT_FOUND: line 1:8: SELECT * not allowed from relation that has no columns

I thought it was something to do with my permissions so I fiddled around and reset them and it made no difference. After that didn't work I am out of ideas because fiddling with permissions is how I managed to get around it not working at an earlier point in the tutorial series

I had a look at the parquet file in Visual Studio Code to see if the problem could be in the file being corrupted or something. There are some red underlines around the colons inside the braces. I am not sure if that might have something to do with it

asked 13 days ago23 views
2 Answers
0

The error you're encountering suggests that Athena is unable to recognize any columns in the table you're trying to query. This issue is likely not related to permissions, but rather to how the table is defined in Athena or how it's reading the underlying Parquet file.

Here are a few things you can try to resolve this issue:

  1. Verify table definition: Ensure that the table is properly defined in the AWS Glue Data Catalog. Check if the table schema matches the structure of your Parquet file.

  2. Refresh table metadata: Try running the "MSCK REPAIR TABLE" command on your table in Athena. This can help refresh the table metadata and potentially resolve issues with partitions or column definitions.

  3. Check file format: Confirm that your Parquet file is correctly formatted. The red underlines you see in Visual Studio Code might indicate syntax issues in the file, which could prevent Athena from reading it properly.

  4. Manually define columns: If the automatic schema detection isn't working, you might need to manually define the columns in your CREATE TABLE statement.

  5. Verify file location: Make sure the S3 location specified in your table definition matches where your Parquet file is actually stored.

  6. Check for empty files: Ensure that your Parquet file is not empty and contains actual data.

  7. Use ALTER TABLE: If you've made changes to your Parquet file structure, you might need to use ALTER TABLE to update the table definition in Athena.

If none of these steps resolve the issue, you may need to recreate the table in Athena, ensuring that the table definition accurately reflects the structure of your Parquet file. Remember, Athena relies on the table definitions in the AWS Glue Data Catalog to understand the structure of your data, so any mismatch between the actual data and the table definition can lead to errors like the one you're experiencing.
Sources
Amazon Athena Features – Serverless Interactive Query Service – Amazon Web Services
Considerations and limitations for querying data registered with Lake Formation - Amazon Athena

profile picture
answered 13 days ago
0

I tried running msck repair table and now have a different error

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

Hopefully that allows me to get to the bottom of what is causing my issues. I should clarify that the data is not yet in parquet file format that transformation comes later in the tutorial series so I made an error there. In addition when I tried renaming the fields in the schema I also got an error here which I just looked at now and the error message seems to be about permissions on altering. I progressed regardless because I did not think it would cascade into further problems

answered 13 days 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.

Guidelines for Answering Questions