Python을 사용하여 Snowflake 통합 관리¶
Snowflake에서는 Python을 사용하여 다양한 유형의 통합을 관리할 수 있습니다.
전제 조건¶
이 항목의 예제에서는 Snowflake와 연결하고 Snowflake Python APIs 을 사용할 수 있는 Root 오브젝트를 생성하는 코드를 추가했다고 가정합니다.
예를 들어, 다음 코드는 구성 파일에 정의된 연결 매개 변수를 사용하여 Snowflake에 대한 연결을 생성합니다.
해당 코드에서는 결과 Session 오브젝트를 사용하여 API의 유형과 메서드를 사용하기 위해 Root 오브젝트를 생성합니다. 자세한 내용은 Snowflake Python APIs 을 사용하여 Snowflake에 연결 섹션을 참조하십시오.
카탈로그 통합 관리¶
계정에서 Apache Iceberg™ 테이블에 대한 카탈로그 통합을 관리할 수 있습니다. 카탈로그 통합은 이름이 지정된 계정 수준의 Snowflake 오브젝트로, Snowflake를 Iceberg 카탈로그로 사용하지 않거나 Snowflake Open Catalog 와 통합하려는 경우 시나리오에 대한 Iceberg 테이블 메타데이터가 어떻게 구성되는지에 대한 정보를 저장합니다. 자세한 내용은 Apache Iceberg™ 테이블 의 카탈로그 통합 섹션을 참조하십시오.
참고
ALTER CATALOG INTEGRATION 는 현재 지원되지 않습니다.
그만큼 Snowflake Python APIs 두 가지 별도 유형의 카탈로그 통합을 나타냅니다.
CatalogIntegration: 카탈로그 통합의 이름, 테이블 형식, 카탈로그 설정 등 속성을 표시합니다.CatalogIntegrationResource: 해당CatalogIntegration오브젝트를 가져오고 카탈로그 통합을 삭제하는 데 사용할 수 있는 메서드를 노출합니다.
카탈로그 통합 만들기¶
카탈로그 통합을 생성하려면 먼저 CatalogIntegration 오브젝트를 생성한 다음 API Root 오브젝트에서 CatalogIntegrationCollection 오브젝트를 생성합니다. CatalogIntegrationCollection.create 를 사용하여 Snowflake에 새로운 카탈로그 통합을 추가합니다.
사용자의 계정에서 다음 유형의 외부 Iceberg 카탈로그에 대한 카탈로그 통합을 생성할 수 있습니다.
AWS Glue¶
다음 예제의 코드는 지정된 속성을 가진 AWS Glue를 사용하는 Iceberg 테이블에 대해 my_catalog_integration 라는 이름의 카탈로그 통합을 나타내는 CatalogIntegration 오브젝트를 생성합니다.
오브젝트 저장소¶
다음 예제의 코드는 지정된 속성을 가진 오브젝트 스토어를 사용하는 Iceberg 테이블에 대해 my_catalog_integration 라는 이름의 카탈로그 통합을 나타내는 CatalogIntegration 오브젝트를 생성합니다.
Snowflake Open Catalog¶
다음 예제의 코드는 지정된 속성을 가진 Open Catalog 를 사용하는 Iceberg 테이블에 대해 my_catalog_integration 라는 이름의 카탈로그 통합을 나타내는 CatalogIntegration 오브젝트를 생성합니다.
카탈로그 통합 세부 정보 가져오기¶
CatalogIntegration 오브젝트를 반환하는 CatalogIntegrationResource.fetch 메서드를 호출하여 카탈로그 통합에 대한 정보를 얻을 수 있습니다.
다음 예제의 코드는 my_catalog_integration 카탈로그 통합에 대한 정보를 가져옵니다.
카탈로그 통합 목록¶
CatalogIntegration 오브젝트의 PagedIter 반복기를 반환하는 CatalogIntegrationCollection.iter 메서드를 사용하여 카탈로그 통합을 나열할 수 있습니다.
다음 예제의 코드는 이름이 my 로 시작하는 카탈로그 통합을 나열하고 각 계정의 이름을 출력합니다.
카탈로그 통합 삭제하기¶
카탈로그 통합을 CatalogIntegrationResource 오브젝트로 삭제할 수 있습니다.
다음 예제의 코드는 my_catalog_integration 카탈로그 통합 리소스 오브젝트를 가져온 다음 카탈로그 통합을 삭제합니다.
알림 통합 관리하기¶
Snowflake 오브젝트인 알림 통합을 관리할 수 있습니다. 알림 통합은 Snowflake와 서드 파티 메시징 서비스(서드 파티 클라우드 메시지 큐 서비스, 이메일 서비스, 웹훅 등) 간의 인터페이스를 제공합니다. 자세한 내용은 Snowflake의 알림 섹션을 참조하십시오.
참고
ALTER NOTIFICATION INTEGRATION 는 현재 지원되지 않습니다.
Snowflake Python APIs 은 두 가지 유형의 알림 통합을 나타냅니다.
NotificationIntegration: 알림 통합의 속성(이름, 알림 후크 설정 등)을 표시합니다.NotificationIntegrationResource: 해당NotificationIntegration오브젝트를 가져오고 알림 통합을 삭제하는 데 사용할 수 있는 메서드를 노출합니다.
알림 통합 만들기¶
알림 통합을 생성하려면 먼저 NotificationIntegration 오브젝트를 생성한 다음 API Root 오브젝트에서 NotificationIntegrationCollection 오브젝트를 생성합니다. NotificationIntegrationCollection.create 를 사용하여 Snowflake에 새 알림 통합을 추가합니다.
다음 유형의 메시징 서비스에 대해 알림 통합을 생성할 수 있습니다.
이메일¶
다음 예제의 코드는 NotificationEmail 속성이 지정되고 이름이 my_email_notification_integration 인 알림 통합을 나타내는 NotificationIntegration 오브젝트를 생성합니다
웹후크¶
다음 예제의 코드는 NotificationWebhook 속성이 지정되고 이름이 my_webhook_notification_integration 인 알림 통합을 나타내는 NotificationIntegration 오브젝트를 생성합니다
Amazon SNS 항목(아웃바운드)¶
다음 예제의 코드는 NotificationQueueAwsSnsOutbound 속성이 지정되고 이름이 my_aws_sns_outbound_notification_integration 인 알림 통합을 나타내는 NotificationIntegration 오브젝트를 생성합니다
Azure Event Grid 항목(아웃바운드)¶
다음 예제의 코드는 NotificationQueueAzureEventGridOutbound 속성이 지정되고 이름이 my_azure_outbound_notification_integration 인 알림 통합을 나타내는 NotificationIntegration 오브젝트를 생성합니다
Azure Event Grid 항목(인바운드)¶
다음 예제의 코드는 NotificationQueueAzureEventGridInbound 속성이 지정되고 이름이 my_azure_inbound_notification_integration 인 알림 통합을 나타내는 NotificationIntegration 오브젝트를 생성합니다
Google Pub/Sub 항목(아웃바운드)¶
다음 예제의 코드는 NotificationQueueGcpPubsubOutbound 속성이 지정되고 이름이 my_gcp_outbound_notification_integration 인 알림 통합을 나타내는 NotificationIntegration 오브젝트를 생성합니다
Google Pub/Sub 항목(인바운드)¶
다음 예제의 코드는 NotificationQueueGcpPubsubInbound 속성이 지정되고 이름이 my_gcp_inbound_notification_integration 인 알림 통합을 나타내는 NotificationIntegration 오브젝트를 생성합니다
알림 통합 세부 정보 가져오기¶
NotificationIntegration 오브젝트를 반환하는 NotificationIntegrationResource.fetch 메서드를 호출하여 알림 통합에 대한 정보를 얻을 수 있습니다.
다음 예제의 코드는 my_notification_integration 알림 통합에 대한 정보를 가져옵니다.
알림 통합 나열하기¶
NotificationIntegration 오브젝트의 PagedIter 반복기를 반환하는 NotificationIntegrationCollection.iter 메서드를 사용하여 알림 통합을 나열할 수 있습니다.
다음 예제의 코드는 이름이 my 로 시작하는 알림 통합을 나열하고 각 계정의 이름을 출력합니다.
알림 통합 삭제하기¶
알림 통합을 NotificationIntegrationResource 오브젝트로 삭제할 수 있습니다.
다음 예제의 코드는 my_notification_integration 알림 통합 리소스 오브젝트를 가져온 다음 알림 통합을 삭제합니다.