
Tables
Unlike views, tables store data persistently, and the data remains available even after the Spark session ends.
Create a table from DataFrame
If you want to save a DataFrame for future reference, you can save it as a table:
# Sample code to create a managed tabledf.write.saveAsTable("table1")
Read the table into a DataFrame
Read tables into a DataFrame for further transformations:
df_new = spark.read.table("table1")