imports:stream#

#rai imports:stream [OPTIONS]

Creates a data stream from a Snowflake table or view to a RelationalAI (RAI) model. At least one engine with a READY state must be available to create a data stream. You must have SELECT privileges and change tracking must be enabled on the source object. See Supported Column Types for a list of column types supported in a data stream’s source table or view. Requires the cdc_admin application role.

Options#

OptionTypeDescription
--sourceTextThe fully-qualified name of a Snowflake table or view, e.g. <db>.<schema>.<table_or_view>. If missing, you are prompted to select the source interactively.
--modelTextThe name of the model to stream data into. If missing, you are prompted to select the model interactively.

Supported Column Types#

Data streams support the following Snowflake column types:

Tables or views with unsupported column types cannot be used as data stream sources.

NOTE

If you need to stream data from a source object with unsupported column types, consider creating a view without those columns or that casts the unsupported columns to a supported type.

Example#

Use the imports:stream command without to create a data stream from a Snowflake table or view into a RAI model:

#$ rai imports:stream --model myModel --source MY_DATABASE1.MY_SCHEMA1.MY_TABLE1

---------------------------------------------------

▰▰▰▰ Stream for MY_DATABASE1.MY_SCHEMA1.MY_TABLE1 created

---------------------------------------------------

If you do not provide the --source or --model options, you are prompted to select the source and model interactively:

#❯ rai imports:stream

---------------------------------------------------

▰▰▰▰ Models fetched

? Select a model:
┌──────────────────────────────────────────────────────────────────────────────────────────┐
│❯   2/2                                                                                   │
│❯ MyModel                                                                                 │
│  MyModel2                                                                                │
└──────────────────────────────────────────────────────────────────────────────────────────┘

▰▰▰▰ Databases fetched

? Select a database:
┌──────────────────────────────────────────────────────────────────────────────────────────┐
│❯   2/2                                                                                   │
│❯ MY_DATABASE1                                                                            │
│  MY_DATABASE2                                                                            │
└──────────────────────────────────────────────────────────────────────────────────────────┘

▰▰▰▰ Schemas fetched

? Select a schema:
┌──────────────────────────────────────────────────────────────────────────────────────────┐
│❯   2/2                                                                                   │
│❯ MY_SCHEMA1                                                                              │
│  MY_SCHEMA2                                                                              │
└──────────────────────────────────────────────────────────────────────────────────────────┘

▰▰▰▰ Tables fetched

? Select tables (tab for multiple):
┌──────────────────────────────────────────────────────────────────────────────────────────┐
│❯   2/2 (0)                                                                               │
│❯ MY_TABLE1                                                                               │
│  MY_TABLE2                                                                               │
└──────────────────────────────────────────────────────────────────────────────────────────┘

▰▰▰▰ Stream for MY_DATABASE1.MY_SCHEMA1.MY_TABLE1 created

---------------------------------------------------

Use the up and down arrow keys to navigate the interactive prompts and press Enter to select an option. You may select multiple tables to import by pressing the tab key. Each prompt is searchable. Simply start typing to filter the available options.

See Data Management for more information on data streams and data management. Refer to Defining Objects From Rows in Snowflake Tables for details on how streams are used in model.

See Also#