DBTimes
Defines fields for the Data Warehouse application that uses the DW ETL library. The configuration JSON file can have other fields at the top level in addition to the dwEtl object.
Configuration for the DW ETL process.
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
If the value is true, the library will send some dataframe-related output to standard output, which slows down job execution.
The ETL process consists of two parts: ETL dimensions and ETL facts. jobType is used to run either both parts or just one of them. The allowed values for this attribute are "LoadDimsFacts", "LoadDims", and "LoadFacts". The main scenario for running ETL dimensions separately from ETL facts is loading dimensions in parallel by defining separate configurations for one or more dimensions (using isLoad) and running ETL facts afterwards, either serially or in parallel.
The flag indicates whether the load is initial or subsequent. If the load is initial, the existing files for dimensions and/or facts are deleted. Which ones are deleted depends on the jobType: for "LoadDimsFacts", both dimension and fact files are deleted; for "LoadDims", dimension files are deleted; and for "LoadFacts", fact files are deleted.
There is one use case in which this flag should be set to true for ongoing loads: when a dimension or fact has to be recreated every time from the current sources, i.e., when rows for non-existent natural keys are deleted and all attributes are Type 1.
This attribute is used to rerun a subsequent load, based on the log, for effective dates that were processed earlier, after the specified timestamp value.
When this attribute is defined, the ETL runner will create a file with summary information for each load. The information includes record counts, descriptions of the source and destination, and action timing.
The file type for load control is Parquet.
A Parquet file path.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
Staging sources. These are the sources for loading dimensions and fact tables.
No Additional ItemsThe staging source id is a unique identifier of a staging source. It is used as the view name for the respective source in Spark SQL.
A column in the staging source data that holds the effective date for the current staging source.
A column in the staging source data that holds the source load timestamp. The timestamp can be used for incremental processing of a dimension in subsequent ETL runs.
An attribute that specifies how to derive the effective date from effectiveDateColumn. The values can be
"DISTINCT" - only the dates in the staging source are used in the ETL,
"WEEKDAYS" - all days between the min and max values, excluding weekends, or
"ALL" - all days between the min and max values
Defines a file staging source.
A Parquet file path.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
A section of specifications for attributes common to all dimensions.
The package name is used to dynamically create an instance of a dimension class. All dimension classes described in a configuration must be defined in the same package.
A regular expression pattern for the dimension name. Each dimension's name must match this pattern.
A section that describes a dimension destination file. The file for each dimension will be created and maintained by the ETL library.
The file type for the dimension destination is Parquet.
Defines the destination file path for all dimensions. The file name in the path must contain three underscores as a placeholder for the dimension name.
Must match regular expression:^.*___.*$
If defined, DW ETL will preserve the previous version of the dimension and place it in this path. The file name must contain three underscores as a placeholder for the dimension name.
Must match regular expression:^.*___.*$
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
Describes dimensions. Since dimensions can be loaded in parallel via independent ETL runs, this array can have some dimensions absent or inactive (i.e., with the 'isLoad' flag set to false).
No Additional ItemsThe name of the dimension. Must match the pattern defined in the dimensionNamePattern field.
If set to false, the dimension will not be loaded. Can be used to create separate configurations to load specific dimensions, or during development to skip the load of already tested dimensions.
Ids of staging sources used to load this dimension. DW ETL will call a loadDim override for each source. If there are no staging sources, loadDim will be called just once.
No Additional ItemsOther dimensions that are sources for loading this dimension. A dimension that is a source must be loaded prior to loading this dimension.
No Additional ItemsThe name of the dimension.
The schema lists a subset of columns used to load the current dimension (used for optimization, to reduce the number of columns). If the schema is absent, all columns can be referenced when loading the current dimension.
No Additional ItemsColumn name
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
Specifications for dimension columns
Must contain a minimum of 1 items
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
true
'scdType' is not applicable for a key column
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
true
'scdType' is not applicable for a Natural Key column
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
true
'isSurrogateKey' and 'unknownValue' are required for a key column
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
true
'unknownValue' is required for a natural key column
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
true
'colType' value must be Long if the column is a surrogate key, as a surrogate key is derived from Spark monotonicallyincreasingid.
Specific value:"Long"
The name of the dimension column.
The data type of the dimension column. colType must be Short, Integer, or Long if the column is a dimension key (i.e., "isKey": true).
If true, this column is a dimension key.
isSurrogateKey can only be defined for dimension key column, i.e., when "isKey": true. If true, this column is a surrogate key and its value will be generated using increasing, but not necessarily sequential, distinct values. The data type for a surrogate key must be "Long".
If isSurrogateKey is false or not defined, the value for the key column must be provided together with the rest of the dimension values.
The unknown value must be a valid value for the column data type. Use the yyyy-mm-dd format for the Date type. If the unknown value is not specified, it will be set to NULL for any column except the dimension key; the default unknown value for the dimension key is 0 (zero).
A flag to indicate that a column is a natural key for the dimension. Multiple columns can be defined as natural keys to create a compound natural key.
Slowly changing dimension column modeling technique: 0 - Retain Original Non-Null Value, 1 - Overwrite, 2 - Add New Row, 3 - Retain Latest Non-Null Value. Default: 1.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
A section of specifications for attributes common to all fact tables.
All fact classes described in a configuration must be defined in the same package. The package name is used to dynamically create an instance of a fact class.
A regular expression pattern for the fact table name. Each fact table's name must match this pattern.
A section that describes a fact table destination file. The file for each fact table will be created and maintained by the ETL library.
The file type for the fact table destination is Parquet.
Defines the destination file path for all fact tables. For example, "path" : "/dw/data/dm/FactNamePlaceholder.parquet". The text FactNamePlaceholder in the path must match the factNamePattern above. The text 'FactNamePlaceholder' will be replaced with the actual fact table name, which also has to match the pattern.
Must match regular expression:^.*___.*$
If defined, DW ETL will create a fact table with the natural keys that were used to set the fact table keys, in addition to the regular fact table. This file is used mostly in development to ensure that dimension keys are set correctly on a fact table and to troubleshoot unknown keys. Its help in troubleshooting unknown keys can make this file useful in production as well. Creating this file has a relatively low performance cost.
Must match regular expression:^.*___.*$
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
Specifications for fact tables or facts (fact table and fact are used interchangeably). Since facts can be loaded in parallel via independent ETL runs, this array can have some facts absent or inactive (i.e., with the 'isLoad' flag set to false).
No Additional ItemsThe name of the fact table. The name must match the pattern defined in the factNamePattern attribute.
If set to false, the fact table will not be loaded. Set it to false during development to skip loading of some fact tables. Can also be used in production to create different configurations to load fact tables in parallel.
The following fact processing modes are supported on subsequent ETL runs:
• REPLACE – the new fact table replaces the old one. A fact table can have one or more partition columns, i.e., columns with the isForPartition flag set to true. If partition columns are defined, the fact table will be replaced and partitioned.
• REPLACEPARTITION – this mode is similar to REPLACE, but it requires partition columns. In this mode, new partitions replace old partitions with the same name, but if no new partition exists for some existing old partitions, those old partitions will remain.
• MERGE – old fact table rows are merged with new ones based on the merge key columns. All rows in the old fact table with the same merge key are replaced with the new ones. Old rows with merge keys that do not exist in the new fact table will remain.
• MERGEPARTITION – this mode is similar to MERGE, but in addition to the merge key it takes the partition column into consideration.
• ADD – new rows are added to existing ones. A fact table can have one or more partition columns. If partition columns are defined, the new rows are added to the respective partitions.
Ids of staging sources used to load this fact table. DW ETL will call a loadFact override for each source. If there are no staging sources, loadFact will be called just once.
No Additional ItemsOther dimensions that are used to load this fact table. These dimensions must be distinguished from dimensions used to set keys. A dimension needs to be listed here if it is used to load fact values, as opposed to setting keys. Dimensions used to set keys are defined in the schema.
No Additional ItemsThe name of the dimension.
Specifications for dimension columns used in loading the fact table.
No Additional ItemsColumn name
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.
Specifications for fact columns.
The fact table is constructed from the schema using the following rules:
• If one or more "isForPartition" columns are defined, the fact table will be partitioned on these columns using the Spark partitioning feature.
• Distinct "foreignKey" values will be used to create the fact table foreign keys. If multiple columns are needed to set a foreign key, the schema will have multiple elements with the same foreign key value, one for each column needed to set the key. For example, if two columns from the underlying dimension are needed to set a key, the fact table schema will have two elements with the same "foreignKey" value.
• Columns with the "isMeasure" attribute set will be added to the fact table as measures.
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
true
If the "isForSettingForeignKey" attribute of a column is set to true, there should be two more properties defined, foreignKey and underlyingDim, plus the optional underlyingDimCol.
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
true
The name of the column for the result of the select in the loadFact method. This will be the name of the column for measures (i.e., when "isMeasure": true), but not the name of the foreign key column. See the "foreignKey" attribute for the names of the foreign keys.
The type of the column whose name is defined in "colName". The data type of a measure column must be Double, Short, Integer, or Long. The type of a foreign key is determined by the type of the respective key in the underlying dimension.
A flag to indicate that this column is used for partitioning fact data. For example, for column { "colName" : "SeasonYear", "colType" : "Integer", "isForPartition" : true } the fact directory structure would look like this:
FactPlays.parquet
SeasonYear=2013
SeasonYear=2014
SeasonYear=2015
SeasonYear=2016
SeasonYear=2017
To query partitioned fact tables in, for example, Apache Drill, use syntax like this:
select * from dfs.fact-file-path/FactPlay.parquet where dir0='SeasonYear=2016'
A flag to indicate that the column is used for merging fact data during subsequent loads. All fact table records whose merge key value is present in the new fact table will be deleted and replaced with the new values.
This flag must be set on a column of Date type to designate a column as the effective date if fact table references a dimension with SCD type 2 column. Only one column in the fact table schema can have this attribute set to true.
When isForSettingForeignKey is set, this column is used to set a foreign key from a dimension on a fact row. The column is either part of the natural dimension key or some other column in a dimension that is used in custom logic to set a foreign dimension key.
If this attribute of a column is set to true, there should be two more properties defined, foreignKey and underlyingDim, plus the optional underlyingDimCol.
For example, if a dimension has three natural key columns that comprise a unique compound key, the schema would have three columns, one for each natural key, to set one foreign key on the resulting fact table.
If underlyingDimCol is not defined, the setForeignKeyOnFactTable method must be overridden to implement custom logic for setting the foreign key on the fact table.
The name of the foreign key column on the fact table. If the foreign key is set using multiple fields (compound key) from the underlying dimension, there will be multiple schema elements with the same "foreignKey" value. There will be only one column with that name in the fact table.
The name of the dimension with the primary key for the given "foreignKey".
The name of the column in the underlying dimension that is used to set the given "foreignKey". If all underlying dimension columns have isNaturalKey set to true, the default implementation of setForeignKeyOnFactTable will be used, otherwise this method will have to be overridden in the corresponding dimension class.
This flag designates a column as a fact table measure (or fact). The measure column must be one of the numeric types: Float, Short, Integer, or Long.
true
All properties whose name matches the following regular expression must respect the following conditions
Property name regular expression:^__
Comment field begins with two underscores. There can be any number of comment fields.