Skip to main content
Dependencies:
  • ProphecySparkBasicsPython 0.2.15+
Cluster requirements:
  • UC dedicated clusters not supported
  • UC standard clusters not supported
  • Livy clusters not supported
Reads from and writes to Iceberg tables, including Iceberg merge operations and time travel.

Required Settings

To use the Source gem with the Iceberg catalog table type, you must configure the following required settings at the environment, initialization, and runtime stages.

Environment Setting

Configure the following Spark JAR dependency package in your fabric environment: https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-spark-runtime-3.3_2.12/1.5.0/iceberg-spark-runtime-3.3_2.12-1.5.0.jar This dependency is available on your compute platform where you installed Spark, such as your Databricks cluster, EMR, or Dataproc.

Initialization Settings

Configure the following Spark session property during the Spark session initialization.
  • Key: spark.sql.extensions
  • Value: org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions
You can also do this during cluster bootstrap. For example, you can set --properties "spark:spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtentions" \ with a create clusters command.

Runtime Settings

The following properties allow you to configure multiple catalogs and your respective metastores for Iceberg tables and data management. To configure Spark conf properties:
  1. Navigate to Pipeline Settings.
    • Click at the top of the Prophecy canvas.
    • Under Manage, click Pipeline Settings.
    Open Pipeline Settings
  2. In your Spark tab, under Spark Configuration, add your Spark conf properties. Spark Pipeline Settings
To configure Hadoop as a catalog, add the following Spark conf properties:
  • spark.sql.catalog.<catalog_name>=org.apache.iceberg.spark.SparkCatalog
  • spark.sql.catalog.<catalog_name>.type=hadoop
  • spark.sql.catalog.<catalog_name>.warehouse=gs://<bucket>/<folder_1>/<folder_1>/
To configure Hive as a catalog, add the following Spark conf properties:
  • spark.sql.catalog.<catalog_name>=org.apache.iceberg.spark.SparkCatalog
  • spark.sql.catalog.<catalog_name>.type=hive
    • spark.sql.catalog.<catalog_name>.warehouse=gs://<bucket>/<folder_1>/<folder_1>/
    • spark.sql.catalog.<catalog_name>.uri=thrift://10.91.64.30:9083
You can set the default catalog by using spark.default.catalog=<catalog_name>.

Parameters

The Source and Target gems require the following parameters to read from and write to Iceberg:

Source

The Source gem reads data from Iceberg and allows you to optionally specify the following additional properties.

Source properties

You can only select Read timestamp or Read snapshot, not both.If you don’t use a time travel option, the Source gem fetches the most recent version of each row by default.
To learn more about Iceberg time travel and its use cases, see Apache Iceberg TIMETRAVEL.

Example

Compiled code

To see the compiled code of your project, switch to the Code view in the project header.

Target

The Target gem writes data to Iceberg and allows you to optionally specify the following additional properties.

Target properties

Supported write modes

Among these write modes, overwrite and append work the same way for parquet file writes.

Target Example

Compiled code

To see the compiled code of your project, switch to the Code view in the project header.