temporary_view
To define a view in Python, apply the @temporary_view decorator, then reference views by name in other queries, including materialized views and streaming tables. The results of the view are calculated when queried.
The older dlt module used the @view decorator to defiine a temporary view. Databricks recommends using the pyspark.pipelines module (imported as dp) and the @temporary_view decorator to define temporary views.
Syntax
from pyspark import pipelines as dp
@dp.temporary_view(
  name="<name>",
  comment="<comment>")
@dp.expect(...)
def <function-name>():
    return (<query>)
Parameters
| Parameter | Type | Description | 
|---|---|---|
| function | 
 | Required. A function that returns an Apache Spark DataFrame or streaming DataFrame from a user-defined query. | 
| 
 | 
 | The view name. If not provided, defaults to the function name. The name must be unique within the catalog and schema targeted by the pipeline. | 
| 
 | 
 | A description for the table. |