view
To define a view in Python, apply the @view
decorator. Like the @table
decorator, you can use views in DLT for either static or streaming datasets. The following is the syntax for defining views with Python:
Syntax
Python
import dlt
@dlt.view(
name="<name>",
comment="<comment>")
@dlt.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 table name. If not provided, defaults to the function name. |
|
| A description for the table. |