Slide 27
Slide 27 text
© Recruit Co., Ltd. All Rights Reserved
完全合致テストの自動化
27
$ dbt build -s is_same --vars \
'{target_table: "sample_table", except_columns: "column1,column2", where_condition: column3="HOGE"}'
14:48:01 Running with dbt=1.2.1
14:48:01 Unable to do partial parsing because config vars, config profile, or config target have changed
14:48:04 Found 132 models, 577 tests, 0 snapshots, 0 analyses, 739 macros, 0 operations, 2 seed files, 138 sources, 24
exposures, 0 metrics
14:48:04
14:48:11 Concurrency: 4 threads (target='dev')
14:48:11
14:48:11 1 of 1 START table model dsu_treasure_data.is_same ............................. [RUN]
14:48:14 1 of 1 OK created table model dsu_treasure_data.is_same ........................ [CREATE TABLE (0.0 rows, 1.1 MB processed) in
3.21s]
14:48:14
14:48:14 Finished running 1 table model in 0 hours 0 minutes and 9.75 seconds (9.75s).
14:48:14
14:48:14 Completed successfully
14:48:14
14:48:14 Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1
※実際のところ、このコマンドはエラー時の解析が手間なので、コンパイルしたSQLの方がよく使われた
事例紹介
開発環境のデータと本番環境のデータが合致するのかをワンライナーで自動チェック