title: How to createOrReplaceTempView in Delta Lake?
body: <p>I want to use Delta Lake tables in my Hive Metastore on Azure Data Lake Gen2 as basis for my company's lakehouse.</p>
  <p>Previously, I used &quot;regular&quot; hive catalog tables. I would load data from parquet into a spark dataframe, and create a temp table using <code>df.CreateOrReplaceTempView(&quot;TableName&quot;)</code>, so I could use Spark SQL or %%sql magic to do ETL. After doing this, I can use <code>spark.sql</code> or <code>%%sql</code> on the TableName. When I was done, I would <code>write</code> my tables to the hive metastore.</p>
  <p>However, what If I don't want to perform this saveAsTable operation, and write to my Data Lake? What would be the best way to perform ETL with SQL?</p>
  <p>I know I can persist Delta Tables in the Hive Metastore through a multitude of ways, for instance by creating a Managed catalog table through <code>df.write.format(&quot;delta&quot;).saveAsTable(&quot;LakeHouseDB.TableName&quot;)</code></p>
  <p>I also know that I can create a DeltaTable object through the <code>DeltaTable(spark, table_path_data_lake)</code>, but then I can only use the Python API and not sql.</p>
  <p>Does there exist some equivalent of <code>CreateOrReplaceTempView()</code>, or is there a better way to achieve ETL with SQL without 'writing' to the data lake first?</p>