Issue with account mapping queries.

0

Hi,

I'have deployed dashboards and trying to mapping account id with names. I'm following this link of Option 2 by using s3 file.

When i try to run below query it gives me error

Cannot create table on file, please specify a directory This query ran against the "cid_cur" database, unless qualified by the query

After adding db with table like 'cid_cur'.'account_mapping' it gives error.

line 1:8: mismatched input 'EXTERNAL'. Expecting: 'MATERIALIZED', 'OR', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW'

 CREATE EXTERNAL TABLE IF NOT EXISTS account_mapping(
   account_id string, account_name string, environment string, business_unit string, team string)
 ROW FORMAT DELIMITED 
   FIELDS TERMINATED BY ',' 
 STORED AS INPUTFORMAT 
   'org.apache.hadoop.mapred.TextInputFormat' 
 OUTPUTFORMAT 
   'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
 LOCATION
   's3://account_map.csv'
 TBLPROPERTIES (
   'has_encrypted_data'='false',
   'skip.header.line.count'='1')

I got stuck and tried many ways to fix it. Please help if I'm missing anything.

已提問 8 個月前檢視次數 455 次
1 個回答
4
已接受的答案

Assuming, you are doing it using option-2, can you redo the steps and this time specify a directory for account_map.csv file. If you have already followed the directory structure as outlined in Well Architected Lab, then you just need to modify your query where in Location, you need not to give account_map.csv file uri but the directory where this file exists.

I see in your query, you have mentioned file location, you need to provide the directory name instead where this file exists.

I'm highlighting that in following snapshot:

Enter image description here

Also, double check the columns, as I see the difference in your query and the one which is there in Well Architected Lab/Snapshot above.

Hope this helps.

Comment here if you have additional questions, happy to help.

Abhishek

profile pictureAWS
專家
已回答 8 個月前
profile pictureAWS
專家
iBehr
已審閱 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南