Skip to content

relationalai.api.object_reference()

object_reference(object_type STRING, object_fq_name STRING)

A function that creates an object reference for a specified Snowflake table or view in Snowflake. Used to provide a reference to the source object for the api.create_data_stream() procedure. You must have SELECT privileges on the object to create a reference. Requires the app_user application role.

NameTypeDescription
object_typeSTRINGThe type of Snowflake object, either 'TABLE' or 'VIEW'.
object_nameSTRINGThe fully-qualified name of the object, e.g. '<db>.<schema>.<table_or_view>'.

Use api.object_reference() to create a reference to a Snowflake table or view when creating a data stream:

SET obj_name = '<db>.<schema>.<table>';
SET obj_type = 'TABLE' -- Replace with 'VIEW' if your object is a view.
SET obj_ref = relationalai.api.object_reference($obj_type, $obj_name);
-- Create a data stream from the object reference.
ALTER TABLE IDENTIFIER($obj_name) SET CHANGE_TRACKING = TRUE;
CALL relationalai.api.create_data_stream($obj_ref, 'MyModel', $obj_name, TRUE);

See Data Management for more information on data streams.