# Databricks notebook source
# MAGIC %md
# MAGIC ### Create temporary view on a DF

# COMMAND ----------

# MAGIC %run ../includes/configuration

# COMMAND ----------

race_results_df = spark.read.parquet(f'{presentation_folder_path}/race_results')

# COMMAND ----------

race_results_df.createOrReplaceTempView('v_race_results')

# COMMAND ----------

# MAGIC %sql
# MAGIC select * from v_race_results

# COMMAND ----------

races_results_2019 = spark.sql('select * from v_race_results where race_year = 2019')

# COMMAND ----------

display(races_results_2019)

# COMMAND ----------

# MAGIC %md
# MAGIC ### Create Global Temporary View

# COMMAND ----------

race_results_df.createOrReplaceGlobalTempView('gv_race_results')

# COMMAND ----------

# MAGIC %sql
# MAGIC show tables in global_temp

# COMMAND ----------

# MAGIC %sql
# MAGIC select * from global_temp.gv_race_results

# COMMAND ----------

sql_objec
b9f6ddda6f2d990bde2a56dcd4840d21469e385c
<mask token>

<mask token>
race_results_df.createOrReplaceTempView('v_race_results')
<mask token>
display(races_results_2019)
race_results_df.createOrReplaceGlobalTempView('gv_race_results')
sql_objec

race_results_df = spark.read.parquet(f'{presentation_folder_path}/race_results'
    )
race_results_df.createOrReplaceTempView('v_race_results')
races_results_2019 = spark.sql(
    'select * from v_race_results where race_year = 2019')
display(races_results_2019)
race_results_df.createOrReplaceGlobalTempView('gv_race_results')
sql_objec

# Databricks notebook source
# MAGIC %md
# MAGIC ### Create temporary view on a DF

# COMMAND ----------

# MAGIC %run ../includes/configuration

# COMMAND ----------

race_results_df = spark.read.parquet(f'{presentation_folder_path}/race_results')

# COMMAND ----------

race_results_df.createOrReplaceTempView('v_race_results')

# COMMAND ----------

# MAGIC %sql
# MAGIC select * from v_race_results

# COMMAND ----------

races_results_2019 = spark.sql('select * from v_race_results where race_year = 2019')

# COMMAND ----------

display(races_results_2019)

# COMMAND ----------

# MAGIC %md
# MAGIC ### Create Global Temporary View

# COMMAND ----------

race_results_df.createOrReplaceGlobalTempView('gv_race_results')

# COMMAND ----------

# MAGIC %sql
# MAGIC show tables in global_temp

# COMMAND ----------

# MAGIC %sql
# MAGIC select * from global_temp.gv_race_results

# COMMAND ----------

sql_objec