Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
import dlt
@dlt.view(
name="<name>",
comment="<comment>")
@dlt.expect(...)
def <function-name>():
return (<query>)
Parameters
Parameter | Type | Description |
---|---|---|
function | function |
Required. A function that returns an Apache Spark DataFrame or streaming DataFrame from a user-defined query. |
name |
str |
The table name. If not provided, defaults to the function name. |
comment |
str |
A description for the table. |