firestreak
firestreak

Reputation: 447

Trying to create an external table from JSON in hive

{"name":"Our Example","link_params":{"cid":"eml_mmj_{date('yyyyMMdd')}"},"template":"Great Example Television","day":"2016-10-02","list_name":"Example Television","id":5112652}

Here's an example row from the json file.

CREATE TABLE company_analysis.extable (
    name string,
    link_params struct<cid:STRING>,
    template string,
    day string,
    list_name string,
    id string)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
STORED AS TEXTFILE
LOCATION '/analysis/company/extable';

This is the command I've been trying.

I'm getting a blank return when I select * from it.

Any ideas? This is my first time working with JSON and I'm not really a hive expert.

I added the json-serde-1.3.7-jar-with-dependencies.jar file here, not sure if that was the best/only route.

Upvotes: 1

Views: 3242

Answers (1)

firestreak
firestreak

Reputation: 447

My bad, was no data in the location... no idea why it wasn't there! The command works fine though.

Upvotes: 1

Related Questions