Class/Object

io.smartdatalake.workflow.dataobject

DeltaLakeTableDataObject

Related Docs: object DeltaLakeTableDataObject | package dataobject

Permalink

case class DeltaLakeTableDataObject(id: DataObjectId, path: Option[String], partitions: Seq[String] = Seq(), options: Option[Map[String, String]] = None, schemaMin: Option[StructType] = None, table: Table, saveMode: SDLSaveMode = SDLSaveMode.Overwrite, allowSchemaEvolution: Boolean = false, retentionPeriod: Option[Int] = None, acl: Option[AclDef] = None, connectionId: Option[ConnectionId] = None, expectedPartitionsCondition: Option[String] = None, housekeepingMode: Option[HousekeepingMode] = None, metadata: Option[DataObjectMetadata] = None)(implicit instanceRegistry: InstanceRegistry) extends TransactionalSparkTableDataObject with CanMergeDataFrame with CanEvolveSchema with CanHandlePartitions with HasHadoopStandardFilestore with Product with Serializable

DataObject of type DeltaLakeTableDataObject. Provides details to access Tables in delta format to an Action. Note that in Spark 2.x Catalog for DeltaTable is not supported. This means that table db/name are not used. It's the path that

Delta format maintains a transaction log in a separate _delta_log subfolder. The schema is registered in Metastore by DeltaLakeTableDataObject.

The following anomalies might occur: - table is registered in metastore but path does not exist -> table is dropped from metastore - table is registered in metastore but path is empty -> error is thrown. Delete the path to clean up - table is registered and path contains parquet files, but _delta_log subfolder is missing -> path is converted to delta format - table is not registered but path contains parquet files and _delta_log subfolder -> Table is registered - table is not registered but path contains parquet files without _delta_log subfolder -> path is converted to delta format and table is registered - table is not registered and path does not exists -> table is created on write

id

unique name of this data object

path

hadoop directory for this table. If it doesn't contain scheme and authority, the connections pathPrefix is applied. If pathPrefix is not defined or doesn't define scheme and authority, default schema and authority is applied.

partitions

partition columns for this data object

options

Options for Delta Lake tables see: https://docs.delta.io/latest/delta-batch.html and org.apache.spark.sql.delta.DeltaOptions

schemaMin

An optional, minimal schema that this DataObject must have to pass schema validation on reading and writing.

table

DeltaLake table to be written by this output

saveMode

SDLSaveMode to use when writing files, default is "overwrite". Overwrite, Append and Merge are supported for now.

allowSchemaEvolution

If set to true schema evolution will automatically occur when writing to this DataObject with different schema, otherwise SDL will stop with error.

retentionPeriod

Optional delta lake retention threshold in hours. Files required by the table for reading versions younger than retentionPeriod will be preserved and the rest of them will be deleted.

acl

override connection permissions for files created tables hadoop directory with this connection

connectionId

optional id of io.smartdatalake.workflow.connection.HiveTableConnection

expectedPartitionsCondition

Optional definition of partitions expected to exist. Define a Spark SQL expression that is evaluated against a PartitionValues instance and returns true or false Default is to expect all partitions to exist.

housekeepingMode

Optional definition of a housekeeping mode applied after every write. E.g. it can be used to cleanup, archive and compact partitions. See HousekeepingMode for available implementations. Default is None.

metadata

meta data

Linear Supertypes
Serializable, Serializable, Product, Equals, HasHadoopStandardFilestore, CanHandlePartitions, CanEvolveSchema, CanMergeDataFrame, TransactionalSparkTableDataObject, CanWriteDataFrame, TableDataObject, SchemaValidation, CanCreateDataFrame, DataObject, AtlasExportable, SmartDataLakeLogger, ParsableFromConfig[DataObject], SdlConfigObject, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DeltaLakeTableDataObject
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. HasHadoopStandardFilestore
  7. CanHandlePartitions
  8. CanEvolveSchema
  9. CanMergeDataFrame
  10. TransactionalSparkTableDataObject
  11. CanWriteDataFrame
  12. TableDataObject
  13. SchemaValidation
  14. CanCreateDataFrame
  15. DataObject
  16. AtlasExportable
  17. SmartDataLakeLogger
  18. ParsableFromConfig
  19. SdlConfigObject
  20. AnyRef
  21. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DeltaLakeTableDataObject(id: DataObjectId, path: Option[String], partitions: Seq[String] = Seq(), options: Option[Map[String, String]] = None, schemaMin: Option[StructType] = None, table: Table, saveMode: SDLSaveMode = SDLSaveMode.Overwrite, allowSchemaEvolution: Boolean = false, retentionPeriod: Option[Int] = None, acl: Option[AclDef] = None, connectionId: Option[ConnectionId] = None, expectedPartitionsCondition: Option[String] = None, housekeepingMode: Option[HousekeepingMode] = None, metadata: Option[DataObjectMetadata] = None)(implicit instanceRegistry: InstanceRegistry)

    Permalink

    id

    unique name of this data object

    path

    hadoop directory for this table. If it doesn't contain scheme and authority, the connections pathPrefix is applied. If pathPrefix is not defined or doesn't define scheme and authority, default schema and authority is applied.

    partitions

    partition columns for this data object

    options

    Options for Delta Lake tables see: https://docs.delta.io/latest/delta-batch.html and org.apache.spark.sql.delta.DeltaOptions

    schemaMin

    An optional, minimal schema that this DataObject must have to pass schema validation on reading and writing.

    table

    DeltaLake table to be written by this output

    saveMode

    SDLSaveMode to use when writing files, default is "overwrite". Overwrite, Append and Merge are supported for now.

    allowSchemaEvolution

    If set to true schema evolution will automatically occur when writing to this DataObject with different schema, otherwise SDL will stop with error.

    retentionPeriod

    Optional delta lake retention threshold in hours. Files required by the table for reading versions younger than retentionPeriod will be preserved and the rest of them will be deleted.

    acl

    override connection permissions for files created tables hadoop directory with this connection

    connectionId

    optional id of io.smartdatalake.workflow.connection.HiveTableConnection

    expectedPartitionsCondition

    Optional definition of partitions expected to exist. Define a Spark SQL expression that is evaluated against a PartitionValues instance and returns true or false Default is to expect all partitions to exist.

    housekeepingMode

    Optional definition of a housekeeping mode applied after every write. E.g. it can be used to cleanup, archive and compact partitions. See HousekeepingMode for available implementations. Default is None.

    metadata

    meta data

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val acl: Option[AclDef]

    Permalink

    override connection permissions for files created tables hadoop directory with this connection

  5. def addFieldIfNotExisting(writeSchema: StructType, colName: String, dataType: DataType): StructType

    Permalink
    Attributes
    protected
    Definition Classes
    CanCreateDataFrame
  6. val allowSchemaEvolution: Boolean

    Permalink

    If set to true schema evolution will automatically occur when writing to this DataObject with different schema, otherwise SDL will stop with error.

    If set to true schema evolution will automatically occur when writing to this DataObject with different schema, otherwise SDL will stop with error.

    Definition Classes
    DeltaLakeTableDataObject → CanEvolveSchema
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def atlasName: String

    Permalink
    Definition Classes
    TableDataObject → DataObject → AtlasExportable
  9. def atlasQualifiedName(prefix: String): String

    Permalink
    Definition Classes
    TableDataObject → AtlasExportable
  10. def checkFilesExisting(implicit session: SparkSession): Boolean

    Permalink

    Check if the input files exist.

    Check if the input files exist.

    Attributes
    protected
    Exceptions thrown

    IllegalArgumentException if failIfFilesMissing = true and no files found at path.

  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. val connectionId: Option[ConnectionId]

    Permalink

    optional id of io.smartdatalake.workflow.connection.HiveTableConnection

  13. def createReadSchema(writeSchema: StructType)(implicit session: SparkSession): StructType

    Permalink
    Definition Classes
    CanCreateDataFrame
  14. def deletePartitions(partitionValues: Seq[PartitionValues])(implicit session: SparkSession): Unit

    Permalink

    Note that we will not delete the whole partition but just the data of the partition because delta lake keeps history

    Note that we will not delete the whole partition but just the data of the partition because delta lake keeps history

    Definition Classes
    DeltaLakeTableDataObject → CanHandlePartitions
  15. def dropTable(implicit session: SparkSession): Unit

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → TableDataObject
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. val expectedPartitionsCondition: Option[String]

    Permalink

    Optional definition of partitions expected to exist.

    Optional definition of partitions expected to exist. Define a Spark SQL expression that is evaluated against a PartitionValues instance and returns true or false Default is to expect all partitions to exist.

    Definition Classes
    DeltaLakeTableDataObject → CanHandlePartitions
  18. def factory: FromConfigFactory[DataObject]

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → ParsableFromConfig
  19. def failIfFilesMissing: Boolean

    Permalink

    Configure whether io.smartdatalake.workflow.action.Actions should fail if the input file(s) are missing on the file system.

    Configure whether io.smartdatalake.workflow.action.Actions should fail if the input file(s) are missing on the file system.

    Default is false.

  20. val filetype: String

    Permalink
  21. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def getConnection[T <: Connection](connectionId: ConnectionId)(implicit registry: InstanceRegistry, ct: ClassTag[T], tt: scala.reflect.api.JavaUniverse.TypeTag[T]): T

    Permalink
    Attributes
    protected
    Definition Classes
    DataObject
  24. def getConnectionReg[T <: Connection](connectionId: ConnectionId, registry: InstanceRegistry)(implicit ct: ClassTag[T], tt: scala.reflect.api.JavaUniverse.TypeTag[T]): T

    Permalink
    Attributes
    protected
    Definition Classes
    DataObject
  25. def getDataFrame(partitionValues: Seq[PartitionValues] = Seq())(implicit session: SparkSession, context: ActionPipelineContext): DataFrame

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → CanCreateDataFrame
  26. def getPKduplicates(implicit session: SparkSession, context: ActionPipelineContext): DataFrame

    Permalink
    Definition Classes
    TableDataObject
  27. def getPKnulls(implicit session: SparkSession, context: ActionPipelineContext): DataFrame

    Permalink
    Definition Classes
    TableDataObject
  28. def getPKviolators(implicit session: SparkSession, context: ActionPipelineContext): DataFrame

    Permalink
    Definition Classes
    TableDataObject
  29. def hadoopPath(implicit session: SparkSession): Path

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → HasHadoopStandardFilestore
  30. val housekeepingMode: Option[HousekeepingMode]

    Permalink

    Optional definition of a housekeeping mode applied after every write.

    Optional definition of a housekeeping mode applied after every write. E.g. it can be used to cleanup, archive and compact partitions. See HousekeepingMode for available implementations. Default is None.

    Definition Classes
    DeltaLakeTableDataObject → DataObject
  31. val id: DataObjectId

    Permalink

    unique name of this data object

    unique name of this data object

    Definition Classes
    DeltaLakeTableDataObject → DataObject → SdlConfigObject
  32. def init(df: DataFrame, partitionValues: Seq[PartitionValues], saveModeOptions: Option[SaveModeOptions] = None)(implicit session: SparkSession, context: ActionPipelineContext): Unit

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → CanWriteDataFrame
  33. implicit val instanceRegistry: InstanceRegistry

    Permalink
  34. def isDbExisting(implicit session: SparkSession): Boolean

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → TableDataObject
  35. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  36. def isPKcandidateKey(implicit session: SparkSession, context: ActionPipelineContext): Boolean

    Permalink
    Definition Classes
    TableDataObject
  37. def isTableExisting(implicit session: SparkSession): Boolean

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → TableDataObject
  38. def listPartitions(implicit session: SparkSession, context: ActionPipelineContext): Seq[PartitionValues]

    Permalink

    List partitions.

    List partitions. Note that we need a Spark SQL statement as there might be partition directories with no current data inside

    Definition Classes
    DeltaLakeTableDataObject → CanHandlePartitions
  39. lazy val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    SmartDataLakeLogger
  40. def mergeDataFrameByPrimaryKey(df: DataFrame, saveModeOptions: SaveModeMergeOptions)(implicit session: SparkSession, context: ActionPipelineContext): Unit

    Permalink

    Merges DataFrame with existing table data by using DeltaLake Upsert-statement.

    Merges DataFrame with existing table data by using DeltaLake Upsert-statement.

    Table.primaryKey is used as condition to check if a record is matched or not. If it is matched it gets updated (or deleted), otherwise it is inserted.

    This all is done in one transaction.

  41. val metadata: Option[DataObjectMetadata]

    Permalink

    meta data

    meta data

    Definition Classes
    DeltaLakeTableDataObject → DataObject
  42. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  43. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  44. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  45. val options: Option[Map[String, String]]

    Permalink

    Options for Delta Lake tables see: https://docs.delta.io/latest/delta-batch.html and org.apache.spark.sql.delta.DeltaOptions

  46. def partitionLayout(): Option[String]

    Permalink
    Definition Classes
    HasHadoopStandardFilestore
  47. val partitions: Seq[String]

    Permalink

    partition columns for this data object

    partition columns for this data object

    Definition Classes
    DeltaLakeTableDataObject → CanHandlePartitions
  48. val path: Option[String]

    Permalink

    hadoop directory for this table.

    hadoop directory for this table. If it doesn't contain scheme and authority, the connections pathPrefix is applied. If pathPrefix is not defined or doesn't define scheme and authority, default schema and authority is applied.

  49. def preWrite(implicit session: SparkSession, context: ActionPipelineContext): Unit

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → DataObject
  50. def prepare(implicit session: SparkSession, context: ActionPipelineContext): Unit

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → DataObject
  51. val retentionPeriod: Option[Int]

    Permalink

    Optional delta lake retention threshold in hours.

    Optional delta lake retention threshold in hours. Files required by the table for reading versions younger than retentionPeriod will be preserved and the rest of them will be deleted.

  52. val saveMode: SDLSaveMode

    Permalink

    SDLSaveMode to use when writing files, default is "overwrite".

    SDLSaveMode to use when writing files, default is "overwrite". Overwrite, Append and Merge are supported for now.

  53. val schemaMin: Option[StructType]

    Permalink

    An optional, minimal schema that this DataObject must have to pass schema validation on reading and writing.

    An optional, minimal schema that this DataObject must have to pass schema validation on reading and writing.

    Definition Classes
    DeltaLakeTableDataObject → SchemaValidation
  54. val separator: Char

    Permalink
    Attributes
    protected
  55. def streamingOptions: Map[String, String]

    Permalink
    Definition Classes
    CanWriteDataFrame
  56. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  57. var table: Table

    Permalink

    DeltaLake table to be written by this output

    DeltaLake table to be written by this output

    Definition Classes
    DeltaLakeTableDataObject → TableDataObject
  58. var tableSchema: StructType

    Permalink
    Definition Classes
    TableDataObject
  59. def toStringShort: String

    Permalink
    Definition Classes
    DataObject
  60. def vacuum(implicit session: SparkSession): Unit

    Permalink
  61. def validateSchema(df: DataFrame, schemaExpected: StructType, role: String): Unit

    Permalink
    Definition Classes
    SchemaValidation
  62. def validateSchemaHasPartitionCols(df: DataFrame, role: String): Unit

    Permalink
    Definition Classes
    CanHandlePartitions
  63. def validateSchemaHasPrimaryKeyCols(df: DataFrame, primaryKeyCols: Seq[String], role: String): Unit

    Permalink
    Definition Classes
    CanHandlePartitions
  64. def validateSchemaMin(df: DataFrame, role: String): Unit

    Permalink
    Definition Classes
    SchemaValidation
  65. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  68. def writeDataFrame(df: DataFrame, createTableOnly: Boolean, partitionValues: Seq[PartitionValues], saveModeOptions: Option[SaveModeOptions])(implicit session: SparkSession, context: ActionPipelineContext): Unit

    Permalink

    Writes DataFrame to HDFS/Parquet and creates DeltaLake table.

    Writes DataFrame to HDFS/Parquet and creates DeltaLake table. DataFrames are repartitioned in order not to write too many small files or only a few HDFS files that are too large.

  69. def writeDataFrame(df: DataFrame, partitionValues: Seq[PartitionValues] = Seq(), isRecursiveInput: Boolean = false, saveModeOptions: Option[SaveModeOptions] = None)(implicit session: SparkSession, context: ActionPipelineContext): Unit

    Permalink
    Definition Classes
    DeltaLakeTableDataObject → CanWriteDataFrame
  70. def writeStreamingDataFrame(df: DataFrame, trigger: Trigger, options: Map[String, String], checkpointLocation: String, queryName: String, outputMode: OutputMode, saveModeOptions: Option[SaveModeOptions])(implicit session: SparkSession, context: ActionPipelineContext): StreamingQuery

    Permalink
    Definition Classes
    CanWriteDataFrame

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from HasHadoopStandardFilestore

Inherited from CanHandlePartitions

Inherited from CanEvolveSchema

Inherited from CanMergeDataFrame

Inherited from TransactionalSparkTableDataObject

Inherited from CanWriteDataFrame

Inherited from TableDataObject

Inherited from SchemaValidation

Inherited from CanCreateDataFrame

Inherited from DataObject

Inherited from AtlasExportable

Inherited from SmartDataLakeLogger

Inherited from ParsableFromConfig[DataObject]

Inherited from SdlConfigObject

Inherited from AnyRef

Inherited from Any

Ungrouped