""" Configuration helper for Feast feature definitions. Allows environment-specific database configuration. IMPORTANT: FEAST_SNOWFLAKE_DATABASE must be set BEFORE importing feature definitions to prevent baking in wrong database values at module import time. """ import os # Get database name from environment variable # REQUIRED: Must be set before importing feature definitions def get_snowflake_database() -> str: """ Get the Snowflake database name from environment variable. REQUIRED: Set FEAST_SNOWFLAKE_DATABASE environment variable before importing feature definitions. This prevents wrong values from being baked in at import time. Raises ValueError if not set to prevent accidental use of wrong database. """ db = os.getenv("FEAST_SNOWFLAKE_DATABASE") if not db: raise ValueError( "FEAST_SNOWFLAKE_DATABASE environment variable must be set before importing " "feature definitions. Set it to match the database in your feature_store YAML config. " "Example: export FEAST_SNOWFLAKE_DATABASE=SUNO_DEV_DELPHINE" ) return db # Get schema name from environment variable def get_snowflake_schema() -> str: """ Get the Snowflake schema name from environment variable. Set FEAST_SNOWFLAKE_SCHEMA environment variable to override. Defaults to PROD if not set (schema is less critical than database). """ return os.getenv("FEAST_SNOWFLAKE_SCHEMA", "PROD")