Skip to main content
Version: 1.5.0

DatabricksDestination

class
class DatabricksDestination(
host_url: str,
token: str | Secret,
tables: list[str] | str,
volume: str,
catalog: str | None = None,
schema: str | None = None,
warehouse: str | None = None,
warehouse_id: str | None = None,
if_table_exists: IfTableExistStrategySpec = 'append',
schema_strategy: SchemaStrategySpec = 'update',
**kwargs,
)

Bases: DestinationPlugin

Categories: destination

Abstract class for output plugins.

Methods: trigger_output(working_dir, *args, **kwargs) Trigger the exporting of the data. This function will receive the resulting data from the dataset function and must store it in the desired location.

Initializes the DatabricksDestination with the configuration desired to store the data.

Properties

property
host_urlstr

property
if_table_existsIfTableExistStrategySpec

str: The strategy to follow when the table already exists.

property
schema_strategySchemaStrategySpec

str: The strategy to follow when appending to a table with an existing schema.

property
tablesList[str]

property
tokenSecret

Methods

method
chunk
def chunk(working_dir: str, *results: LazyFrame | None) -> List[None | str]

Trigger the exporting of the data to local parquet chunks. This method will receive the resulting data from the user function and must store it in the local system as parquet files, using the working_dir. Note: This method should not materialize the data, it should only store it in the local system.

Parameters:

parameter
working_dirstr

The folder where any files generated must be stored (this refers to temporary files that will be deleted after the execution of the plugin, not the final destination of the data)

parameter
results

The data to be exported. It is a list of polars LazyFrames or None.

Returns:

A list of the intermediate files created

method
stream
def stream(working_dir: str, *results: List[LazyFrame | None] | LazyFrame | None)

Trigger the exporting of the data. This method will receive the resulting data from the user function and must store it in the desired location. Note: this method might materialize the data provided in a single chunk generated by the chunk function if invoked, so chunks should be of an appropriate size.

Parameters:

parameter
working_dirstr

The folder where any intermediate files generated must be stored (this refers to temporary files that will be deleted after the execution of the plugin, not the final destination of the data)

parameter
results

The data to be exported. It is a list of polars LazyFrames or None.

Returns:

None

method
write
def write(files)

This method is used to write the files to the databricks. It is called from the stream method, and it is not intended to be called directly.