Skip to content


CreateDeltaTableCommand is a RunnableCommand (Spark SQL).

Creating Instance

CreateDeltaTableCommand takes the following to be created:

  • CatalogTable (Spark SQL)
  • Existing CatalogTable (if available)
  • SaveMode
  • Optional Data Query (LogicalPlan)
  • CreationMode (default: TableCreationModes.Create)
  • tableByPath flag (default: false)

CreateDeltaTableCommand is created when:

Executing Command

  sparkSession: SparkSession): Seq[Row]

run creates a DeltaLog (for the given table based on a table location) and a DeltaOptions.

run starts a transaction.

run branches off based on the optional data query. For data query defined, run creates a WriteIntoDelta and requests it to write. Otherwise, run creates an empty table.


run does a bit more, but I don't think it's of much interest.

run commits the transaction.

In the end, run updateCatalog.

run is part of the RunnableCommand abstraction.


  spark: SparkSession,
  table: CatalogTable): Unit

updateCatalog uses the given SparkSession to access SessionCatalog to createTable or alterTable when the tableByPath flag is off. Otherwise, updateCatalog does nothing.


  metadata: Metadata,
  isManagedTable: Boolean,
  options: Option[DeltaOptions]): DeltaOperations.Operation


Back to top