You are viewing documentation about an older version (0.13.1). View latest version

snowflake.core.pipe.PipeCollection

class snowflake.core.pipe.PipeCollection(schema: SchemaResource)

Bases: SchemaObjectCollectionParent[PipeResource]

Represents the collection operations of the Snowflake Pipe resource.

With this collection, you can create, iterate through, and search for pipes that you have access to in the current context.

Examples

Creaing a pipe instance:

>>> pipes = root.databases["my_db"].schemas["my_schema"].pipes
>>>     new_pipe = Pipe(
...         name="my_pipe",
...         comment="This is a pipe")
>>> pipes.create(new_pipe)

Attributes

database
root

Methods

create(pipe: Pipe, *, mode: CreateMode = CreateMode.error_if_exists) PipeResource

Create a pipe in Snowflake.

Parameters:
  • pipe (Pipe)

  • mode (CreateMode, optional) –

    One of the following strings.

    CreateMode.error_if_exists: Throw an snowflake.core.exceptions.ConflictError if the pipe already exists in Snowflake. Equivalent to SQL create pipe <name> ....

    CreateMode.or_replace: Replace if the pipe already exists in Snowflake. Equivalent to SQL create or replace pipe <name> ....

    CreateMode.if_not_exists: Do nothing if the pipe already exists in Snowflake. Equivalent to SQL create pipe <name> if not exists...

    Default value is CreateMode.error_if_exists.

Examples

Creating a pipe in Snowflake and getting reference to it:

>>> pipe_parameters = Pipe(
...     name="my_pipe",
...     comment="This is a pipe"
... )
>>> # Use the pipe collection created before to create a referece to the pipe resource
>>> # in Snowflake.
>>> pipe_reference = pipe_collection.create(pipe_parameters)
items() ItemsView[str, T]
iter(*, like: str | None = None) Iterator[Pipe]

Iterate through Pipe objects in Snowflake, filtering on any optional like pattern.

Parameters:

like (str, optional) – A case-insensitive string functioning as a filter, with support for SQL wildcard characters (% and _).

Examples

Showing all pipes that you have access to see:

>>> pipes = pipe_collection.iter()

Showing information of the exact pipe you want to see:

>>> pipes = pipe_collection.iter(like="your-pipe-name")

Showing pipes starting with ‘your-pipe-name’:

>>> pipes = pipe_collection.iter(like="your-pipe-name%")

Using a for loop to retrieve information from iterator:

>>> for pipe in pipes:
>>>     print(pipe.name, pipe.comment)
keys() KeysView[str]
values() ValuesView[T]