write_file
WriteFileAction
¶
Bases: PipelineAction
This class implements a Write action for an ETL pipeline.
The WriteFileAction writes a Dataframe to a storage location defined in the
options using the FileWriter class.
Example
Source code in src/cloe_nessy/pipeline/actions/write_file.py
run(context, *, path='', format='delta', partition_cols=None, mode='append', is_stream=False, options=None, **_)
¶
Writes a file to a location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
PipelineContext
|
Context in which this Action is executed. |
required |
path
|
str
|
Location to write data to. |
''
|
format
|
str
|
Format of files to write. |
'delta'
|
partition_cols
|
list[str] | None
|
Columns to partition on. If None, the writer will try to get the partition columns from the metadata. Default None. |
None
|
mode
|
str
|
Specifies the behavior when data or table already exists. |
'append'
|
is_stream
|
bool
|
If True, use the |
False
|
options
|
dict[str, str] | None
|
Additional options passed to the writer. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no path is provided. |
ValueError
|
If the table metadata is empty. |
Returns:
| Type | Description |
|---|---|
PipelineContext
|
Pipeline Context |