snowflake.core.catalog_integration.CatalogIntegrationCollection¶

class snowflake.core.catalog_integration.CatalogIntegrationCollection(root: Root)¶

Bases: AccountObjectCollectionParent[CatalogIntegrationResource]

Represents the collection operations on the Snowflake Catalog Integration resource.

With this collection, you can create, iterate through, and fetch catalog integrations that you have access to in the current context.

Examples

Creating a catalog integration instance by object store:

>>> root.catalog_integrations.create(CatalogIntegration(
...     name = 'my_catalog_integration',
...     catalog = ObjectStore(),
...     table_format = "ICEBERG",
...     enabled = True,
... ))
Copy

Attributes

root¶

Methods

create(catalog_integration: CatalogIntegration, mode: CreateMode = CreateMode.error_if_exists) → CatalogIntegrationResource¶

Create a catalog integration in Snowflake.

Parameters:
  • catalog_integration (CatalogIntegration) – The CatalogIntegration object, together with CatalogIntegration’s properties: name, table_format, enabled, catalog; comment, type, category are optional

  • mode (CreateMode, optional) –

    One of the following enum values:

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

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

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

    Default is CreateMode.error_if_exists.

Examples

Creating a catalog integration instance by glue:

>>> root.catalog_integrations.create(CatalogIntegration(
...     name = 'my_catalog_integration',
...     catalog = Glue(
...         catalog_namespace="abcd-ns",
...         glue_aws_role_arn="arn:aws:iam::123456789012:role/sqsAccess",
...         glue_catalog_id="1234567",
...     ),
...     table_format = "ICEBERG",
...     enabled = True,
... ))
Copy

Creating a catalog integration instance by object store:

>>> root.catalog_integrations.create(CatalogIntegration(
...     name = 'my_catalog_integration',
...     catalog = ObjectStore(),
...     table_format = "ICEBERG",
...     enabled = True,
... ))
Copy

Creating a catalog integration instance by polaris:

>>> root.catalog_integrations.create(CatalogIntegration(
...     name = 'my_catalog_integration',
...     catalog = Polaris(
...         catalog_namespace="abcd-ns",
...         rest_config=RestConfig(
...             catalog_uri="https://my_account.snowflakecomputing.com/polaris/api/catalog",
...             warehouse_name="my_warehouse",
...         ),
...         rest_authenticator=OAuth(
...             type="OAUTH",
...             oauth_client_id="my_oauth_client_id",
...             oauth_client_secret="my_oauth_client_secret",
...             oauth_allowed_scopes=["PRINCIPAL_ROLE:ALL"],
...         ),
...     ),
...     table_format = "ICEBERG",
...     enabled = True,
... ))
Copy
items() → ItemsView[str, T]¶
iter(like: str | None = None) → Iterator[CatalogIntegration]¶

Iterate through CatalogIntegration objects from Snowflake.

Parameters:

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

Examples

Showing all catalog integrations that you have access to see:

>>> catalog_integrations = catalog_integration_collection.iter()
Copy

Showing information of the exact catalog integration you want to see:

>>> catalog_integrations = catalog_integration_collection.iter(like="your-catalog-integration-name")
Copy

Showing catalog integrations starting with ‘your-catalog-integration-name-‘:

>>> catalog_integrations = catalog_integration_collection.iter(like="your-catalog-integration-name-%")
Copy

Using a for loop to retrieve information from iterator:

>>> for catalog_integration in catalog_integrations:
...     print(catalog_integration.name)
Copy
keys() → KeysView[str]¶
values() → ValuesView[T]¶