Sparksql crud operation through hivecontext


#1

Hi All,

Could you please provide an example spark SQL CRUD operation over HiveContext ?All Create, Retrieve, Delete & Update Operations should be done through Spark SQL(HiveContext).


#2

Launch spark-shell by using the command spark-shell --master yarn --conf spark.ui.port = 12345
Connect to hive database using sqlContext
sqlContext.sql(“use database”)

To list the tables use this query
sqlContext.sql(“show tables”).show

To view the data in the table, use the query
sqlContext.sql(“select * from orders limit 10″).show


#3

Insert, Update and Delete are not very common and there are several restrictions.

You can follow this vide for further details


#4

@dgadiraju thank you sir