How can I make a simple insert in Spark SQL ? spark 2.1
I am able to make it work with simple sql code inside spark, with Spark.sql but it is not possible for me to make just an insert.
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName('Basics').getOrCreate()
df=spark.read.json(/path/.'/people.json')
df.sow()
+-----+---------+
|age | name |
+-----+---------+
|null | Michael |
| 30 | And |
+-----+---------+
df.CreateOrReplaceTempView('people') # create temp table
spark.sql("SELECT * FROM people where age == 30")
+-----+---------+
|age | name |
+-----+---------+
| 30 | Andy |
+-----+---------+
So I understand SQL but I dont know who to make an Insert.
I tried all the posibles ways I imagine.