Attributes in Code Generation
How active polymorphic versions become SQL columns in Dynamic Tables, including transformation application and array table generation.
Dynamic Table Column Generation
For each active polymorphic version with INCLUDE_IN_CODE_GEN = TRUE, DataPancake generates a column:
Column name: Uses
ALIAS_NAMEif provided, otherwisePOLYMORPHIC_ATTRIBUTE_NAME→CODE_GENERATED_COLUMN_NAMEType casting: Uses
DATA_PLATFORM_DATA_TYPEwith precision/scale; applies datetime formats ifUSE_DATETIME_FORMAT = TRUEValue extraction: Extracts from source using
ATTRIBUTE_PATH; handles nested structures and arraysTransformation:
If
TRANSFORMATION_TYPE = 'No Transformation': AppliesNULL_VALUE_EXPRESSION(if provided)If
TRANSFORMATION_TYPE = 'SQL Expression': AppliesTRANSFORMATION_EXPRESSION(replaces{attribute_name}placeholder)
Inclusion: Only if
INCLUDE_IN_CODE_GEN = TRUEANDPARENT_INCLUDE_IN_CODE_GEN = TRUEANDVERSION_STATUS = 'active'
Example: Column Generation
Attribute: customer.email with polymorphic version email_str
Configuration:
DATA_PLATFORM_DATA_TYPE = 'VARCHAR(255)'TRANSFORMATION_TYPE = 'No Transformation'NULL_VALUE_EXPRESSION = 'COALESCE({attribute_name}, ''[email protected]'')'ALIAS_NAME = 'customer_email'
Generated SQL:
With transformation:
TRANSFORMATION_TYPE = 'SQL Expression'TRANSFORMATION_EXPRESSION = 'UPPER({attribute_name})'
Generated SQL:
Array Table Generation
Object arrays (ARRAY_TYPE = 'object'):
Separate Dynamic Table created for array contents
Named using
CREATE_OBJECT_NAME_ALIAS_NAMEor default{root_table_name}_array_objectForeign key columns link array table to parent (configured in Foreign Keys section)
Primitive arrays (ARRAY_TYPE = 'primitive'):
May be stored as VARIANT or ARRAY types in root table
Or flattened into separate table depending on configuration
ARRAY_PRIMITIVE_TYPEdetermines element handling
ITDCs (Immutable Typed Derived Columns)
DataPancake uses explicit type casting (::DATA_TYPE) in generated SQL to prevent technical debt from implicit conversions.
Example:
Code Generation Process
Collect active attributes: Query
vw_datasource_active_attributeswhereINCLUDE_IN_CODE_GEN = TRUEandPARENT_INCLUDE_IN_CODE_GEN = TRUEGenerate column statements: For each active version, generate SQL with type casting and transformations
Generate array tables: Separate Dynamic Tables for object arrays with foreign key relationships
Generate root table: Combine all root-level columns with table-level settings
Generate views: Semantic layer views with
SEMANTIC_LAYER_EXPRESSIONand security policies
Metadata Tracking
DataPancake can generate:
Streams: Track changes to Dynamic Tables (change data capture)
Tasks: Scheduled metadata synchronization
Metadata tables: Track insert/update timestamps for audit and compliance
Last updated
Was this helpful?