image repository dbt_database.dbt_spcs.dbt_image_repository; create stage if not exists dbt_stage directory = ( enable = true ); show image_repositories; use role accountadmin; use database dbt_database; use schema dbt_spcs; create or replace network rule dbt_snowflake_egress_access mode = egress type = host_port value_list = ('account.snowflakecomputing.com') ; create or replace external access integration dbt_snowflake_egress_access_integration allowed_network_rules = (dbt_snowflake_egress_access) enabled = true ; show integrations; show grants to role dbt_user; grant usage on integration dbt_snowflake_egress_access_integration to role dbt_user; create stage dbt_database.dbt_spcs.dbt_volumes directory = ( enable = true ) encryption = (type = 'snowflake_sse'); use role accountadmin; create role dbt_user; grant role dbt_user to role accountadmin; create or replace database dbt_database; grant ownership on database dbt_database to role dbt_user copy current grants; create or replace warehouse dbt_warehouse warehouse_size = xsmall auto_suspend = 120 auto_resume = true ; grant usage on warehouse dbt_warehouse to role dbt_user; create security integration if not exists snowservices_ingress_oauth type=oauth oauth_client=snowservices_ingress enabled=true; grant bind service endpoint on account to role dbt_user; create compute pool if not exists dbt_compute_pool min_nodes = 1 max_nodes = 1 auto_suspend_secs = 180 instance_family = CPU_X64_XS; grant usage, monitor, operate on compute pool dbt_compute_pool to role dbt_user; grant role dbt_user to user "Snowflake User Name"; use role dbt_user; use database dbt_database; use warehouse dbt_warehouse; dbtを動かそう① 1. リソース作成 (Snowflake) 2. Imageの作成 (ローカル環境) 3. Serviceの作成 (Snowflake)
DATABASE dbt_log_trace_db; CREATE OR REPLACE WAREHOUSE tutorial_log_trace_wh WAREHOUSE_TYPE = STANDARD WAREHOUSE_SIZE = XSMALL; CREATE OR REPLACE EVENT TABLE dbt_event_table; ALTER ACCOUNT SET EVENT_TABLE = dbt_log_trace_db.public.dbt_event_table; ALTER SESSION SET LOG_LEVEL = INFO; SELECT TIMESTAMP, RESOURCE_ATTRIBUTES, RECORD_ATTRIBUTES, VALUE FROM dbt_log_trace_db.public.dbt_event_table ORDER BY timestamp DESC LIMIT 100; Service作成時にlogLevelを 設定しておく必要があります (デフォルトはNone)