CREATE ONLINE FEATURE TABLE
statementsupportedAI & MLCreates a new online feature table in the current/specified schema or replaces an existing table.
Syntax
supportedpartialnot supportednot scored
CREATE [ OR REPLACE ] ONLINE FEATURE TABLE <name>
PRIMARY KEY ( <col_name> [ , <col_name> , ... ] )
TARGET_LAG = '<num> { seconds | minutes | hours | days }'
WAREHOUSE = <warehouse_name>
[ REFRESH_MODE = { AUTO | FULL | INCREMENTAL } ]
[ TIMESTAMP_COLUMN = <col_name> ]
[ [ WITH ] COMMENT = '<string_literal>' ]
[ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] ) ]
FROM <source>
Parameters
| Name | Required | Description |
|---|---|---|
name | required | String that specifies the identifier (i.e. name) for the online feature table; must be unique for the schema in which the table is created. |
PRIMARY KEY ( col_name [ , col_name , ... ] ) | required | Specifies the required primary key constraint of the table. Primary key serves as a unique identifier of every row in the table and serves as a lookup key in the fast SELECT queries. |
TARGET_LAG = 'num { seconds | minutes | hours | days }' | required | Specifies the maximum amount of time that the online feature table’s content should lag behind updates to the source. Must be between 10 seconds and 8 days, inclusive. |
WAREHOUSE = warehouse_name | required | Specifies the name of the warehouse that provides the compute resources for refreshing the online feature table. You must use a role that has the USAGE privilege on this warehouse in order to create the online feature table. |
FROM source | required | Specifies the data source of the online feature table. Must be either a view or a dynamic table. |
REFRESH_MODE = \{ AUTO | FULL | INCREMENTAL \} | optional | Specifies the refresh mode for the online feature table. Note This property cannot be altered after you create the online feature table. To modify the property, recreate the online feature table. Default: AUTO
|
TIMESTAMP_COLUMN = col_name | optional | Specifies the column in the source treated as the timestamp column. Default: No value |
COMMENT = 'string_literal' | optional | Specifies a comment for the online feature table. Default: No value |
TAG ( tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ] ) | optional | Specifies the tag name and the tag string value. The maximum number of characters for the tag value is 256. Default: No value |
Usage notes
- The OR REPLACE and IF NOT EXISTS clauses are mutually exclusive. They can’t both be used in the same statement.
- CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
- Attention
- Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
Access control requirements
Privilege | Object | Notes CREATE ONLINE FEATURE TABLE | Schema | Role that has the CREATE ONLINE FEATURE TABLE privilege on the schema. USAGE | Warehouse | Required on the warehouse specified in the WAREHOUSE parameter Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
See also
- ALTER ONLINE FEATURE TABLE
- DESCRIBE ONLINE FEATURE TABLE
- DROP ONLINE FEATURE TABLE
- SHOW ONLINE FEATURE TABLES