Skip to content

Snowflake

This module contains the SnowflakeWriter class, which is used to write data to Snowflake.

koheesio.spark.writers.snowflake.SnowflakeWriter #

Class for writing to Snowflake

See Also

insert_type class-attribute instance-attribute #

insert_type: Optional[BatchOutputMode] = Field(
    APPEND,
    alias="mode",
    description="The insertion type, append or overwrite",
)

table class-attribute instance-attribute #

table: str = Field(
    default=..., description="Target table name"
)

execute #

execute()

Write to Snowflake

Source code in src/koheesio/spark/snowflake.py
def execute(self):
    """Write to Snowflake"""
    self.log.debug(f"writing to {self.table} with mode {self.insert_type}")
    self.df.write.format(self.format).options(**self.get_options()).option("dbtable", self.table).mode(
        self.insert_type
    ).save()