PipelineNodeDataSource
laktory.models.datasources.PipelineNodeDataSource
¤
Bases: BaseDataSource
Data Source using an upstream pipeline node. Using a pipeline node data source defines the interdependencies between each node in a pipeline. Depending on the selected pipeline orchestrator and the context, a pipeline node data source might read the data from:
- memory
- upstream node sink
- DLT table
Examples:
from laktory import models
brz = models.PipelineNode(
name="brz_stock_prices",
source={
"path": "/Volumes/sources/landing/events/yahoo-finance/stock_price",
"format": "JSON",
},
sinks=[
{
"path": "/Volumes/sources/landing/tables/brz_stock_prices",
"format": "PARQUET",
}
],
)
slv = models.PipelineNode(
name="slv_stock_prices",
source={"node_name": "brz_stock_prices"},
sinks=[
{
"path": "/Volumes/sources/landing/tables/slv_stock_prices",
"format": "PARQUET",
}
],
)
pl = models.Pipeline(name="pl-stock-prices", nodes=[brz, slv])
# pl.execute(spark=spark)
| PARAMETER | DESCRIPTION |
|---|---|
as_stream
|
If
TYPE:
|
drop_duplicates
|
Remove duplicated rows from source using all columns if
TYPE:
|
drops
|
List of columns to drop
TYPE:
|
filter
|
SQL expression used to select specific rows from the source table
TYPE:
|
node_name
|
Name of the upstream pipeline node
TYPE:
|
reader_kwargs
|
Keyword arguments passed directly to dataframe backend reader. Passed to
TYPE:
|
reader_methods
|
DataFrame backend reader methods.
TYPE:
|
renames
|
Mapping between the source column names and desired column names
TYPE:
|
selects
|
Columns to select from the source. Can be specified as a list or as a dictionary to rename the source columns
TYPE:
|
type
|
Name of the data source type
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
read |
Read data with options specified in attributes. |
read(**kwargs)
¤
Read data with options specified in attributes.
| RETURNS | DESCRIPTION |
|---|---|
AnyFrame
|
Resulting dataframe |
Source code in laktory/models/datasources/basedatasource.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |