Best Practices

Configuration recommendations for attributes, including data type selection, transformation expressions, and performance optimization.

Attribute Configuration

1

Review Discovered Attributes

Always review discovered attributes after scanning:

  • Verify data types are correct

  • Check for unexpected polymorphic versions

  • Understand the structure of your data

  • Identify attributes that may need special handling

2

Adjust Data Types

Edit Snowflake data types if inference is incorrect:

  • Set appropriate precision and scale for numeric types

  • Specify datetime formats for accurate parsing

  • Use correct VARCHAR lengths

  • Consider storage and performance implications

3

Use Alias Names

Create readable alias names for better SQL readability:

  • Follow your organization's naming conventions

  • Consider downstream consumers when naming

  • Make column names self-documenting

  • Avoid overly long or cryptic names

4

Handle Null Values

Set appropriate null value expressions:

  • Consider business logic for missing data

  • Use COALESCE or CASE statements appropriately

  • Document null handling decisions

  • Ensure null handling is consistent across related attributes

5

Configure Transformations

Use transformation expressions for data cleaning:

  • Apply business logic during materialization

  • Document transformation logic in comments

  • Test expressions before deploying

  • Keep transformations maintainable


Virtual Attributes

1

Naming Conventions

Use clear, descriptive names:

  • Follow consistent naming patterns

  • Avoid spaces in attribute names

  • Make names self-explanatory

  • Consider how names appear in generated SQL

2

Transformation Expressions

Write clear, maintainable SQL expressions:

  • Document complex logic in comments

  • Test expressions before deploying

  • Use standard SQL functions

  • Avoid overly complex nested expressions

3

Semantic Model Integration

Use W_QUESTION_CATEGORY appropriately:

  • Create metrics and filters as virtual attributes

  • Link virtual attributes to parent arrays when needed

  • Ensure expressions are compatible with Cortex Analyst

  • Test semantic model queries


Polymorphic Versions

1

Review All Versions

Check all polymorphic versions for an attribute:

  • Understand why multiple versions exist

  • Decide which versions to include in code generation

  • Document decisions about active/inactive versions

  • Monitor for unexpected activations

2

Handle Polymorphism

Use transformation expressions to handle type variations:

  • Consider data quality implications

  • Document polymorphic behavior

  • Use type checking in expressions if needed

  • Ensure transformations handle all active versions

3

Version Management

Keep active only versions you need:

  • Monitor version status dates for schema changes

  • Review inactive versions periodically

  • Understand that inactive versions are ready for activation

  • Don't delete inactive versions unnecessarily


Performance Considerations

1

Include In Code Gen

Only include attributes you actually need:

  • Exclude attributes that won't be used

  • Reduces Dynamic Table size and refresh time

  • Improves query performance

  • Simplifies maintenance

2

Cluster By

Use ADD_TO_CLUSTER_BY for frequently queried attributes:

  • Improves query performance on large tables

  • Consider primary keys and foreign keys

  • Balance clustering with refresh performance

  • Monitor query patterns

3

Data Type Sizing

Use appropriate precision and scale:

  • Avoid over-sizing numeric types

  • Balance between flexibility and storage efficiency

  • Consider future data requirements

  • Optimize for common use cases

Last updated

Was this helpful?