A SnowflakeSource object defines a data source that a SnowflakeOfflineStore class can use.
| 21 | |
| 22 | @typechecked |
| 23 | class SnowflakeSource(DataSource): |
| 24 | """A SnowflakeSource object defines a data source that a SnowflakeOfflineStore class can use.""" |
| 25 | |
| 26 | def __init__( |
| 27 | self, |
| 28 | *, |
| 29 | name: Optional[str] = None, |
| 30 | timestamp_field: Optional[str] = "", |
| 31 | database: Optional[str] = None, |
| 32 | warehouse: Optional[str] = None, |
| 33 | schema: Optional[str] = None, |
| 34 | table: Optional[str] = None, |
| 35 | query: Optional[str] = None, |
| 36 | created_timestamp_column: Optional[str] = "", |
| 37 | field_mapping: Optional[Dict[str, str]] = None, |
| 38 | description: Optional[str] = "", |
| 39 | tags: Optional[Dict[str, str]] = None, |
| 40 | owner: Optional[str] = "", |
| 41 | ): |
| 42 | """ |
| 43 | Creates a SnowflakeSource object. |
| 44 | |
| 45 | Args: |
| 46 | name (optional): Name for the source. Defaults to the table if not specified, in which |
| 47 | case the table must be specified. |
| 48 | timestamp_field (optional): Event timestamp field used for point in time |
| 49 | joins of feature values. |
| 50 | database (optional): Snowflake database where the features are stored. |
| 51 | schema (optional): Snowflake schema in which the table is located. |
| 52 | table (optional): Snowflake table where the features are stored. Exactly one of 'table' |
| 53 | and 'query' must be specified. |
| 54 | query (optional): The query to be executed to obtain the features. Exactly one of 'table' |
| 55 | and 'query' must be specified. |
| 56 | created_timestamp_column (optional): Timestamp column indicating when the |
| 57 | row was created, used for deduplicating rows. |
| 58 | field_mapping (optional): A dictionary mapping of column names in this data |
| 59 | source to column names in a feature table or view. |
| 60 | description (optional): A human-readable description. |
| 61 | tags (optional): A dictionary of key-value pairs to store arbitrary metadata. |
| 62 | owner (optional): The owner of the snowflake source, typically the email of the primary |
| 63 | maintainer. |
| 64 | """ |
| 65 | |
| 66 | if warehouse: |
| 67 | warnings.warn( |
| 68 | "Specifying a warehouse within a SnowflakeSource is to be deprecated." |
| 69 | "Starting v0.32.0, the warehouse as part of the Snowflake store config will be used.", |
| 70 | RuntimeWarning, |
| 71 | ) |
| 72 | |
| 73 | if table is None and query is None: |
| 74 | raise ValueError('No "table" or "query" argument provided.') |
| 75 | if table and query: |
| 76 | raise ValueError('Both "table" and "query" argument provided.') |
| 77 | |
| 78 | # The default Snowflake schema is named "PUBLIC". |
| 79 | _schema = "PUBLIC" if (database and table and not schema) else schema |
| 80 |
no outgoing calls