Skip to content

Commit

Permalink
#520 Add documentation for the identity transformer.
Browse files Browse the repository at this point in the history
  • Loading branch information
yruslan committed Dec 13, 2024
1 parent 7157901 commit f65794b
Showing 1 changed file with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,40 @@ import za.co.absa.pramen.core.transformers.IdentityTransformer._

import java.time.LocalDate

/**
* The transformer does not do any actual transformation and just returns the input DataFrame.
*
* It can be used to copy data between metastore tables located in different storages.
*
* The transformer supports incremental processing.
*
* Example usage:
* {{{
* pramen.operations = [
* {
* name = "Copy table"
* type = "transformation"
*
* class = "za.co.absa.pramen.core.transformers.IdentityTransformer"
* schedule.type = "daily"
*
* dependencies = [
* {
* tables = [ table_from ]
* date.from = "@infoDate"
* }
* ]
*
* option {
* input.table = "table_from"
* empty.allowed = true
* }
*
* output.table = "table_to"
* }
* ]
* }}}
*/
class IdentityTransformer extends Transformer {
override def validate(metastore: MetastoreReader, infoDate: LocalDate, options: Map[String, String]): Reason = {
if (!options.contains(INPUT_TABLE_KEY) && !options.contains(INPUT_TABLE_LEGACY_KEY)) {
Expand Down Expand Up @@ -54,4 +88,4 @@ object IdentityTransformer {
val INPUT_TABLE_KEY = "input.table"
val INPUT_TABLE_LEGACY_KEY = "table"
val EMPTY_ALLOWED_KEY = "empty.allowed"
}
}

0 comments on commit f65794b

Please sign in to comment.