NandSci17
NandSci17

Reputation: 51

Column name with a Space - Athena

I am trying to create a table that has a column name with Space using Athena Console.

Example: "Mag Creative" String

Error: This field is required. Spaces are not allowed!

Upvotes: 3

Views: 11159

Answers (4)

Manoj Prabhakar
Manoj Prabhakar

Reputation: 1016

In my case it was space in the column name So I had to change the create table

create external table temp_table(
Open string,
High string,
Low string,
Close string,
"Adj Close"string...

to

create external table temp_table(
Open string,
High string,
Low string,
Close string,
adj_close string...

Upvotes: 0

Gholibjon Madiyarov
Gholibjon Madiyarov

Reputation: 17

It is not recommended to use a space in the name of a table column; there are special rules for such cases.

Upvotes: 0

Bence Olah
Bence Olah

Reputation: 684

You can try double quotes,like this:

SELECT i."interest expense" FROM "financial-analysis-tool"."income_statement"

Upvotes: 10

Makoto
Makoto

Reputation: 106389

Considering that Athena column names cannot contain any other special character besides underscore, the error is prescriptive and explicit about what the problem is. You must use an underscore for this column name instead.

Upvotes: 0

Related Questions