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)
Copy

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)
Copy
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()
Copy

Showing information of the exact pipe you want to see:

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

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

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

Using a for loop to retrieve information from iterator:

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