nxcals.api.extraction.data.builders.DataFrame.writeTo

DataFrame.writeTo(table: str) DataFrameWriterV2

Create a write configuration builder for v2 sources.

This builder is used to configure and execute write operations.

For example, to append or create or replace existing tables.

Added in version 3.1.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters:

table (str) – Target table name to write to.

Returns:

DataFrameWriterV2 to use further to specify how to save the data

Return type:

DataFrameWriterV2

Examples

>>> df = spark.createDataFrame(
...     [(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"])
>>> df.writeTo("catalog.db.table").append()  
>>> df.writeTo(                              
...     "catalog.db.table"
... ).partitionedBy("col").createOrReplace()