Creating tables from dataframes

 Continuing from our last post: Reading file into dataframe


  • Let's create a table from the dataframe:
    • Dataframe.write.saveAsTable("Database.tablename")
    • We need to remember that we are creating a managed table with the above syntax, and to create an unmanaged table we can add the path option. 
Managed Table

Unmanaged Table


  • Now we can Query the tables using SQL.

  • Reference for the difference between managed and unmanaged tables: Click here 




Comments

Popular posts from this blog

Reading a file into a dataframe using PySpark in Databricks