Provider.create_streams()#

relationalai
#Provider.create_streams(sources: list[str], model:str, force:bool=False) -> None

Stream data from Snowflake tables into a model and block until the streams are ready. Requires the Snowflake user set in your configuration to have the cdc_admin application role.

Parameters#

NameTypeDescription
sourceslist[str]List of Snowflake tables to stream data from. Table names must be fully qualified with the Snowflake database and schema names, e.g. "<db_name>.<schema_name>.<table_name>".
modelstrName of the model to stream data into.
forceboolWhether to force the recreation of streams if they already exist. (Default: False)

Returns#

None

Example#

Use .create_streams() to stream data from Snowflake tables into a model:

#import relationalai as rai

# Create a model.
model = rai.model("MyModel")

# Stream data from Snowflake tables into the model.
app = rai.Provider()
app.create_streams(
    model=model.name,
    sources=[
        "my_db.my_schema.my_table1",
        "my_db.my_schema.my_table2",
    ]
)

# After streams are created, you can use them as sources for types.
Type1 = model.Type("Type1", source="my_db.my_schema.my_table1")
Type2 = model.Type("Type2", source="my_db.my_schema.my_table2")

See Stream Management for details.

See Also#