Skip to main content

writeTo

Create a write configuration builder for v2 sources.

Syntax​

writeTo(table: str)

Parameters​

Parameter

Type

Description

table

str

Target table name to write to.

Parameter

Type

Description

table

str

Target table name to write to.

Returns​

DataFrameWriterV2: DataFrameWriterV2 to use further to specify how to save the data.

Notes​

This builder is used to configure and execute write operations. For example, to append or create or replace existing tables.

Examples​

Python
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()