“INSERT INTO …” with SparkSQL HiveContext

前端 未结 6 1345
你的背包
你的背包 2021-02-05 05:32

I\'m trying to run an insert statement with my HiveContext, like this:

hiveContext.sql(\'insert into my_table (id, score) values (1, 10)\')

Th

6条回答
  •  时光说笑
    2021-02-05 05:45

    Data can be appended to a Hive table using the append mode on the DataFrameWriter.

    data = hc.sql("select 1 as id, 10 as score")
    data.write.mode("append").saveAsTable("my_table")
    

    This gives the same result as an insert.

提交回复
热议问题