Integration & API
Programmatic access to attributes via system views and stored procedures for automation and external system integration.
Views for Attributes
vw_datasource_active_attributes
Purpose: Comprehensive view of all active attributes
Contents:
Both attribute and polymorphic version data
All active polymorphic versions
Complete metadata for code generation
Use Cases:
UI display
Programmatic access to active attributes
Code generation input
Attribute configuration
Example Query:
SELECT *
FROM vw_datasource_active_attributes
WHERE datasource_id = 'your-datasource-id'
AND INCLUDE_IN_CODE_GEN = TRUE
ORDER BY ATTRIBUTE_PATH;vw_datasource_all_attributes
Purpose: Includes all polymorphic versions regardless of status
Contents:
All polymorphic versions (active and inactive)
Complete version history
Schema evolution tracking
Use Cases:
Schema analysis
Version history review
Understanding all possible variations
Schema drift analysis
Example Query:
vw_datasource_version_all_attributes
Purpose: Includes version information for schema evolution tracking
Contents:
Version numbers
Version creation dates
Schema change tracking
Polymorphic version history
Use Cases:
Monitoring schema drift
Tracking schema evolution
Version comparison
Change detection
Example Query:
Stored Procedures
sp_upsert_attribute
Purpose: Creates or updates attributes from scan results
Usage:
Used internally during scanning process
Not typically called directly by users
Handles attribute creation from scan data
Parameters:
DATASOURCE_ID- The data source identifierDATASOURCE_VERSION_ID- The version identifierATTRIBUTE_DATA- JSON string containing attribute data
sp_upsert_virtual_datasource_attribute
Purpose: Creates or updates virtual attributes
Usage:
Create custom virtual attributes
Update existing virtual attributes
Programmatic attribute creation
Parameters:
DATASOURCE_ID- The data source identifierATTRIBUTE_NAME- Name of the virtual attributeSOURCE_DATA_TYPE- Source data typePLATFORM_DATA_TYPE- Snowflake data typeTRANSFORMATION_EXPRESSION- SQL transformation expressionW_QUESTION_CATEGORY- Cortex Analyst category (optional)ATTRIBUTE_DESCRIPTION- Description (optional)ATTRIBUTE_ID- For updates (optional)
Example:
sp_update_attribute_polymorphic_versions
Purpose: Updates polymorphic version metadata
Usage:
Bulk updates to attribute metadata
Programmatic configuration
Integration workflows
Parameters:
UPDATED_VERSION_ROWS_SOURCE_SCHEMA- JSON with source schema updatesUPDATED_VERSION_ROWS_DESTINATION_SCHEMA- JSON with destination schema updatesUPDATED_VERSION_ROWS_TRANSFORMATION- JSON with transformation updatesUPDATED_VERSION_ROWS_CONSOLIDATION- JSON with consolidation updatesUPDATED_VERSION_ROWS_GOVERNANCE- JSON with governance updatesUPDATED_VERSION_ROWS_SEMANTIC_MODEL- JSON with semantic model updates
Supports:
Bulk updates via JSON input
Multiple attribute updates in single call
Different update categories
update_attribute_metadata_core
Purpose: Bulk update via CSV integration
Usage:
External integration workflows
Spreadsheet-based updates
Bulk configuration changes
Parameters:
USER_NAME- User performing the updateATTRIBUTE_DATA- JSON string with attribute dataFILE_PATH- Path to CSV file in Snowflake stage
Process:
Supported Fields (examples):
Data types, precision, scale
DateTime formats
Transformation expressions
Null value expressions
Alias names
Include in code gen flags
Semantic layer configurations
Security policy settings
And many more metadata fields
Bulk Operations
CSV Upload Integration
Process:
CSV Format:
Must include
_IDorPOLYMORPHIC_VERSION_IDcolumnInclude columns for fields to update
Follow DataPancake column naming conventions
Example CSV:
Programmatic Integration
Python Example:
SQL Example:
Integration Patterns
Best Practices for Integration
Error Handling
Always check return values from stored procedures
Handle errors gracefully
Log integration operations
Validate input data before calling procedures
Performance
Batch updates when possible
Use bulk operations for multiple attributes
Avoid updating attributes one-by-one
Monitor procedure execution time
Security
Use appropriate roles and permissions
Validate user input
Audit integration operations
Follow least privilege principles
Last updated
Was this helpful?