0

I have created a table in hive and I need to load csv data into hive table, but the data is in github (I have downloaded and tested it is working fine) I need to load data directly from URL is it possible to load data into hive from URL

something like this can work

LOAD DATA  INPATH 'https://github.com/xx/stock-prices.csv' INTO TABLE 
stocks;
Rahul Varma
  • 550
  • 5
  • 23

1 Answers1

1

Loading data from flat files into Hive can be done using below command.

From Apache Hive Wiki:

LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename [PARTITION (partcol1=val1, partcol2=val2 ...)]

LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename [PARTITION (partcol1=val1, partcol2=val2 ...)] [INPUTFORMAT 'inputformat' SERDE 'serde'] (3.0 or later)

If the keyword LOCAL is specified, Hive looks for file path in local filesystem and loads from there. If the keyword LOCAL is not specified, Hive looks for file path in HDFS filesystem and loads data there.

You can specify full URI for HDFS files as well as local files.

Example:

file:///user/data/project/datafolder (Local Path)

hdfs://namenode:10001/user/data/project/datafolder (HDFS path)

This means it is not possible to load data directly into hive from https. So you have to download the data first and load into hive.

This is not the solution but the correct answer.

arunkvelu
  • 1,631
  • 10
  • 21