How to insert new data to a table in AWS Athena

Mariane Neiva — @maribneiva
2 min readNov 29, 2021

OK, if you read my previous story, you know how to create a table in AWS Athena.

Now, you have been trying to use the classical INSERT INTO query to add more data. Well, you got an error, don’t you?!

No worries, today you will see how easy it is to insert new data to a table in AWS Athena.

Ps.: I assume you created a table using a CSV file.

The process is easy, to add new data, follow the steps below:

  1. Check the number of rows in the table (transactions in the example) prior to the addition in AWS Athena console with:
select count(*) from transations

The result is around 56k.

2. Go to the folder where the data from the original data is located. In my example, I will keep using examplemedium.

3. Click on

4. The upload CSV file should contain the same columns and types as the previous data. We will upload fraudTrain.csv from here.

Upload fraudTrain.csv
After the upload, you will see that both files are in the examplemedium folder

5. Go back to AWS Athena and check the new number of rows in table transactions with

select count(*) from transactions

The result is now: 1852396!

I hope you liked this tutorial!

Please, don’t forget to follow for more!

— Also, let’s keep in touch on Instagram and Linkedin

--

--

Mariane Neiva — @maribneiva

Woman in tech, researcher @University of Sao Paulo. Passionate by artificial intelligence, innovation, scientific communication and programming.