{"id":4437,"date":"2024-02-02T11:19:55","date_gmt":"2024-02-02T02:19:55","guid":{"rendered":"https:\/\/blog.since2020.jp\/?p=4437"},"modified":"2024-02-02T11:19:55","modified_gmt":"2024-02-02T02:19:55","slug":"%e5%b0%8f%e5%a3%b2%e6%a5%ad%e3%81%ae%e3%81%9f%e3%82%81%e3%81%aedbt%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e6%a7%8b%e6%88%90%e3%82%92%e8%80%83%e3%81%88%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/since2020.jp\/media\/%e5%b0%8f%e5%a3%b2%e6%a5%ad%e3%81%ae%e3%81%9f%e3%82%81%e3%81%aedbt%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e6%a7%8b%e6%88%90%e3%82%92%e8%80%83%e3%81%88%e3%81%a6%e3%81%bf%e3%81%9f\/","title":{"rendered":"\u5c0f\u58f2\u696d\u306e\u305f\u3081\u306edbt\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u69cb\u6210\u3092\u8003\u3048\u3066\u307f\u305f"},"content":{"rendered":"\n<p>\u5c0f\u58f2\u696d\u754c\u306f\u81a8\u5927\u306a\u91cf\u306e\u53d6\u5f15\u30c7\u30fc\u30bf\u3092\u65e5\u3005\u751f\u6210\u3057\u3066\u304a\u308a\u3001\u3053\u306e\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u5206\u6790\u3057\u3001\u30d3\u30b8\u30cd\u30b9\u306e\u610f\u601d\u6c7a\u5b9a\u306b\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002dbt (data build tool) \u306f\u3001\u30c7\u30fc\u30bf\u30e2\u30c7\u30ea\u30f3\u30b0\u30d7\u30ed\u30bb\u30b9\u3092\u52b9\u7387\u5316\u3057\u3001\u30c7\u30fc\u30bf\u306e\u5909\u63db\u3092\u5bb9\u6613\u306b\u3059\u308b\u30c4\u30fc\u30eb\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001dbt\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u8003\u306b\u5c0f\u58f2\u696d\u306e\u305f\u3081\u306edbt\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u6210\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u5c0f\u58f2\u696d\u754c\u306f\u81a8\u5927\u306a\u91cf\u306e\u53d6\u5f15\u30c7\u30fc\u30bf\u3092\u65e5\u3005\u751f\u6210\u3057\u3066\u304a\u308a\u3001\u3053\u306e\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u5206\u6790\u3057\u3001\u30d3\u30b8\u30cd\u30b9\u306e\u610f\u601d\u6c7a\u5b9a\u306b\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002dbt (data build tool) \u306f\u3001\u30c7\u30fc\u30bf\u30e2\u30c7\u30ea\u30f3\u30b0\u30d7\u30ed\u30bb\u30b9\u3092\u52b9\u7387\u5316\u3057\u3001\u30c7\u30fc\u30bf\u306e\u5909\u63db\u3092\u5bb9\u6613\u306b\u3059\u308b\u30c4\u30fc\u30eb\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001<a href=\"https:\/\/docs.getdbt.com\/best-practices\/how-we-structure\/1-guide-overview\" class=\"notion-link-token notion-focusable-token notion-enable-hover\" rel=\"noopener noreferrer\" data-token-index=\"1\"><span class=\"link-annotation-unknown-block-id--548056612\">dbt\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/span><\/a>\u3092\u53c2\u8003\u306b\u5c0f\u58f2\u696d\u306e\u305f\u3081\u306edbt\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u6210\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/span><!-- notionvc: aeb13bfb-2bfe-45de-86d8-4ad35dcadf02 --><\/p>\n\n<h2>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u5168\u4f53\u69cb\u9020<\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u307e\u305a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u5168\u4f53\u50cf\u3068\u3057\u3066\u3001\u5c0f\u58f2\u696d\u306b\u7279\u5316\u3057\u305fdbt\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u300csupermarket_retail\u300d\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u30d5\u30a1\u30a4\u30eb\u69cb\u9020\u3092\u6301\u305f\u305b\u307e\u3059\u3002<\/span><!-- notionvc: 0701e6c8-54e5-40c3-ab6f-43c1717815c4 --><\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>supermarket_retail\r\n\u251c\u2500\u2500 README.md # \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u6982\u8981\u3084\u4f7f\u3044\u65b9\u304c\u8a18\u8f09\u3055\u308c\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\r\n\u251c\u2500\u2500 analyses # \u8907\u96d1\u306a\u5206\u6790\u30af\u30a8\u30ea\u3092\u4fdd\u5b58\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n\u251c\u2500\u2500 seeds\r\n\u2502 \u2514\u2500\u2500 products.csv # \u9759\u7684\u306a\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\uff08\u4f8b\uff1a\u5546\u54c1\u30ea\u30b9\u30c8\uff09\r\n\u251c\u2500\u2500 dbt_project.yml # DBT\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u251c\u2500\u2500 macros\r\n\u2502 \u2514\u2500\u2500 yen_tax.sql # SQL\u30de\u30af\u30ed\uff08\u4f8b\uff1a\u7a0e\u8fbc\u307f\u4fa1\u683c\u3092\u8a08\u7b97\u3059\u308b\u30de\u30af\u30ed\uff09\r\n\u251c\u2500\u2500 models # \u30c7\u30fc\u30bf\u30e2\u30c7\u30ea\u30f3\u30b0\u306eSQL\u30d5\u30a1\u30a4\u30eb\u3092\u683c\u7d0d\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n\u2502 \u251c\u2500\u2500 intermediate\r\n\u2502 \u2502 \u2514\u2500\u2500 finance\r\n\u2502 \u2502 \u251c\u2500\u2500 _int_finance__models.yml # \u4e2d\u9593\u5c64\u30d5\u30a1\u30a4\u30ca\u30f3\u30b9\u30e2\u30c7\u30eb\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u2502 \u2502 \u2514\u2500\u2500 int_retail_pivoted_to_orders.sql # \u6ce8\u6587\u30c7\u30fc\u30bf\u306e\u30d4\u30dc\u30c3\u30c8\u51e6\u7406SQL\r\n\u2502 \u251c\u2500\u2500 marts\r\n\u2502 \u2502 \u251c\u2500\u2500 finance\r\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 _finance__models.yml # \u30d5\u30a1\u30a4\u30ca\u30f3\u30b9\u30de\u30fc\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 orders.sql # \u6ce8\u6587\u30c7\u30fc\u30bf\u96c6\u8a08SQL\r\n\u2502 \u2502 \u2502 \u2514\u2500\u2500 payments.sql # \u652f\u6255\u3044\u30c7\u30fc\u30bf\u96c6\u8a08SQL\r\n\u2502 \u2502 \u2514\u2500\u2500 marketing\r\n\u2502 \u2502 \u251c\u2500\u2500 _marketing__models.yml # \u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u30de\u30fc\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u2502 \u2502 \u2514\u2500\u2500 customers.sql # \u9867\u5ba2\u30c7\u30fc\u30bf\u96c6\u8a08SQL\r\n\u2502 \u251c\u2500\u2500 staging\r\n\u2502 \u2502 \u251c\u2500\u2500 supermarket\r\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 _supermarket__docs.md # \u30b9\u30fc\u30d1\u30fc\u30de\u30fc\u30b1\u30c3\u30c8\u30c7\u30fc\u30bf\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\r\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 _supermarket__models.yml # \u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u5c64\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 _supermarket__sources.yml # \u30b9\u30fc\u30d1\u30fc\u30de\u30fc\u30b1\u30c3\u30c8\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 base\r\n\u2502 \u2502 \u2502 \u2502 \u251c\u2500\u2500 base_supermarket__customers.sql # \u57fa\u672c\u9867\u5ba2\u30c7\u30fc\u30bf\u52a0\u5de5SQL\r\n\u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 base_supermarket__deleted_customers.sql # \u524a\u9664\u6e08\u307f\u9867\u5ba2\u30c7\u30fc\u30bf\u51e6\u7406\r\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 stg_supermarket__customers.sql # \u9867\u5ba2\u30c7\u30fc\u30bf\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0SQL\r\n\u2502 \u2502 \u2502 \u2514\u2500\u2500 stg_supermarket__orders.sql # \u6ce8\u6587\u30c7\u30fc\u30bf\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0SQL\r\n\u2502 \u2502 \u2514\u2500\u2500 stripe\r\n\u2502 \u2502 \u251c\u2500\u2500 _stripe__models.yml # Stripe\u30c7\u30fc\u30bf\u30e2\u30c7\u30eb\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u2502 \u2502 \u251c\u2500\u2500 _stripe__sources.yml # Stripe\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\r\n\u2502 \u2502 \u2514\u2500\u2500 stg_stripe__payments.sql # Stripe\u652f\u6255\u3044\u30c7\u30fc\u30bf\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0SQL\r\n\u2502 \u2514\u2500\u2500 utilities\r\n\u2502 \u2514\u2500\u2500 all_dates.sql # \u6c4e\u7528\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\uff08\u4f8b\uff1a\u5168\u65e5\u4ed8\u30c6\u30fc\u30d6\u30eb\u751f\u6210SQL\uff09\r\n\u251c\u2500\u2500 packages.yml # DBT\u30d1\u30c3\u30b1\u30fc\u30b8\u4f9d\u5b58\u95a2\u4fc2\u30d5\u30a1\u30a4\u30eb\r\n\u251c\u2500\u2500 snapshots # \u30c7\u30fc\u30bf\u306e\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3092\u683c\u7d0d\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n\u2514\u2500\u2500 tests\r\n\u2514\u2500\u2500 assert_positive_value_for_total_amount.sql # \u30c6\u30b9\u30c8SQL\uff08\u4f8b\uff1a\u5408\u8a08\u91d1\u984d\u304c\u6b63\u306e\u5024\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\uff09<\/code><\/pre>\r\n<\/div>\n\n<h2>\u30e2\u30c7\u30eb\u306e\u8a73\u7d30\u3068SQL\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e<code>models<\/code><strong>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3001\u30c7\u30fc\u30bf\u306e\u5909\u63db\u3068\u96c6\u8a08\u3092\u884c\u3046\u305f\u3081\u306e\u6838\u5fc3\u90e8\u5206\u3067\u3059\u3002\u5404\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff08<\/strong><code>staging<\/code><strong>\u3001<\/strong><code>intermediate<\/code><strong>\u3001<\/strong><code>marts<\/code>\uff09\u306f\u7279\u5b9a\u306e\u5f79\u5272\u3092\u6301\u3061\u3001\u7570\u306a\u308b\u30bf\u30a4\u30d7\u306e\u30c7\u30fc\u30bf\u5909\u63db\u3092\u62c5\u3044\u307e\u3059\u3002<\/span><\/p>\r\n<b><span style=\"font-size: 18pt;color: #ff6600\"><strong><span style=\"font-family: arial, helvetica, sans-serif\">\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u5c64: <code>stg_supermarket__customers<\/code><\/span><\/strong><\/span><\/b>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u5c64\u306f\u3001\u751f\u30c7\u30fc\u30bf\u3092\u521d\u671f\u51e6\u7406\u3057\u3001\u5206\u6790\u306e\u305f\u3081\u306e\u57fa\u790e\u3092\u4f5c\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001<strong><code>stg_supermarket__customers<\/code><\/strong> \u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u9867\u5ba2\u30c7\u30fc\u30bf\u3092\u52a0\u5de5\u3057\u307e\u3059\u3002<\/span><\/p>\r\n<p><img decoding=\"async\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.01.49.png\" alt=\"\" width=\"1348\" height=\"690\" class=\"alignnone size-full wp-image-4438\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.01.49.png 1348w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.01.49-300x154.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.01.49-1024x524.png 1024w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.01.49-768x393.png 768w\" sizes=\"(max-width: 1348px) 100vw, 1348px\" \/><\/p>\r\n<b><span style=\"font-family: arial, helvetica, sans-serif;color: #ff0000\">\u300c_int_finance__models.yml\u300d<\/span><\/b>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-yaml\"><\/code><\/span><\/pre>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>version: 2\r\n\r\nmodels:\r\n  - name: int_retail_pivoted_to_orders\r\n    description: \"\u6ce8\u6587\u30c7\u30fc\u30bf\u3092\u88fd\u54c1\u3054\u3068\u306b\u30d4\u30dc\u30c3\u30c8\u3057\u305f\u4e2d\u9593\u5c64\u30e2\u30c7\u30eb\"\r\n    columns:\r\n      - name: order_id\r\n        description: \"\u6ce8\u6587\u306e\u4e00\u610f\u8b58\u5225\u5b50\"\r\n      - name: product_A_sales\r\n        description: \"\u88fd\u54c1A\u306e\u58f2\u4e0a\"\r\n      - name: product_B_sales\r\n        description: \"\u88fd\u54c1B\u306e\u58f2\u4e0a\"\r\n      - name: product_C_sales\r\n        description: \"\u88fd\u54c1C\u306e\u58f2\u4e0a\"\r\n<\/code><\/pre>\r\n<\/div>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-yaml\"><\/code><\/span><\/pre>\r\n<b><span style=\"font-family: arial, helvetica, sans-serif;color: #ff0000\">\u300cstg_supermarket__customers.sql\u300d<\/span><\/b>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-sql\"><\/code><\/span><\/pre>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT\r\n    customer_id,\r\n    first_name,\r\n    last_name,\r\n    email,\r\n    created_at\r\nFROM raw_customers_data\r\n<\/code><\/pre>\r\n<\/div>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-sql\"><\/code><\/span><\/pre>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u3053\u306e\u30e2\u30c7\u30eb\u3067\u306f\u3001\u30b9\u30fc\u30d1\u30fc\u30de\u30fc\u30b1\u30c3\u30c8\u306e\u751f\u306e\u9867\u5ba2\u30c7\u30fc\u30bf\u304b\u3089\u5fc5\u8981\u306a\u5217\u3092\u9078\u629e\u3057\u3001\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30c6\u30fc\u30d6\u30eb\u3067\u5229\u7528\u3059\u308b\u305f\u3081\u306b\u6574\u5f62\u3057\u3066\u3044\u307e\u3059\u3002<strong><code>customer_id<\/code><\/strong>\u3001<strong><code>first_name<\/code><\/strong>\u3001<strong><code>last_name<\/code><\/strong>\u3001<strong><code>email<\/code><\/strong>\u3001<strong><code>created_at<\/code><\/strong> \u306a\u3069\u306e\u91cd\u8981\u306a\u9867\u5ba2\u60c5\u5831\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\r\n<b><!-- notionvc: cb28cce3-3860-43c8-95f1-d20d2dbff4c2 --><\/b>\r\n<b><span style=\"font-family: arial, helvetica, sans-serif;font-size: 18pt;color: #0000ff\"><strong>\u4e2d\u9593\u5c64: <code>int_retail_pivoted_to_orders<\/code><\/strong><\/span><\/b>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u4e2d\u9593\u5c64\u3067\u306f\u3001\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u5c64\u306e\u30c7\u30fc\u30bf\u3092\u3055\u3089\u306b\u7d50\u5408\u3057\u3001\u30d3\u30b8\u30cd\u30b9\u306e\u8907\u96d1\u306a\u8981\u4ef6\u306b\u5bfe\u5fdc\u3059\u308b\u305f\u3081\u306e\u52a0\u5de5\u3092\u884c\u3044\u307e\u3059\u3002<\/span><\/p>\r\n<p><img decoding=\"async\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.10.28.png\" alt=\"\" width=\"1440\" height=\"708\" class=\"alignnone size-full wp-image-4439\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.10.28.png 1440w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.10.28-300x148.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.10.28-1024x503.png 1024w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.10.28-768x378.png 768w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/p>\r\n<b><!-- notionvc: 7caebb7f-e940-4341-a022-ece364e0e667 --><\/b>\r\n<b><strong><span style=\"font-family: arial, helvetica, sans-serif;color: #ff0000\">\u300c_int_finance__models.yml\u300d<\/span><\/strong><\/b>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-yaml\"><\/code><\/span><\/pre>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>version: 2\r\n\r\nmodels:\r\n  - name: int_retail_pivoted_to_orders\r\n    description: \"\u6ce8\u6587\u30c7\u30fc\u30bf\u3092\u88fd\u54c1\u3054\u3068\u306b\u30d4\u30dc\u30c3\u30c8\u3057\u305f\u4e2d\u9593\u5c64\u30e2\u30c7\u30eb\"\r\n    columns:\r\n      - name: order_id\r\n        description: \"\u6ce8\u6587\u306e\u4e00\u610f\u8b58\u5225\u5b50\"\r\n      - name: product_A_sales\r\n        description: \"\u88fd\u54c1A\u306e\u58f2\u4e0a\"\r\n      - name: product_B_sales\r\n        description: \"\u88fd\u54c1B\u306e\u58f2\u4e0a\"\r\n      - name: product_C_sales\r\n        description: \"\u88fd\u54c1C\u306e\u58f2\u4e0a\"\r\n<\/code><\/pre>\r\n<\/div>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-yaml\"><\/code><\/span><\/pre>\r\n<b><span style=\"font-family: arial, helvetica, sans-serif;color: #ff0000\">\u300cint_retail_pivoted_to_orders.sql\u300d<\/span><\/b>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-sql\"><\/code><\/span><\/pre>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT\r\n    order_id,\r\n    SUM(CASE WHEN product_id = 'A' THEN quantity ELSE 0 END) AS product_A_sales,\r\n    SUM(CASE WHEN product_id = 'B' THEN quantity ELSE 0 END) AS product_B_sales,\r\n    ...\r\nFROM staged_orders_data\r\nGROUP BY order_id\r\n<\/code><\/pre>\r\n<\/div>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-sql\"><\/code><\/span><\/pre>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u3053\u306eSQL\u3067\u306f\u3001\u6ce8\u6587\u30c7\u30fc\u30bf\u3092\u88fd\u54c1\u3054\u3068\u306b\u30d4\u30dc\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u5404\u6ce8\u6587\u306b\u5bfe\u3057\u3066\u3001\u88fd\u54c1A\u3001\u88fd\u54c1B\u3001\u88fd\u54c1C\u306a\u3069\u306e\u58f2\u4e0a\u3092\u96c6\u8a08\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\r\n<b><!-- notionvc: 8a77ddd4-8015-4102-a02b-2837e33ccb02 --><\/b>\r\n<b><span style=\"font-family: arial, helvetica, sans-serif;font-size: 18pt;color: #339966\"><strong>\u30c7\u30fc\u30bf\u30de\u30fc\u30c8<span style=\"color: #339966\">\u5c64: <code>orders<\/code><\/span><\/strong><\/span><\/b>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u30c7\u30fc\u30bf\u30de\u30fc\u30c8\u5c64\u306f\u3001\u6700\u7d42\u7684\u306a\u30d3\u30b8\u30cd\u30b9\u30a4\u30f3\u30c6\u30ea\u30b8\u30a7\u30f3\u30b9\u3084\u30ec\u30dd\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u305f\u3081\u306e\u30c7\u30fc\u30bf\u96c6\u8a08\u3092\u884c\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001<strong><code>orders<\/code><\/strong> \u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6ce8\u6587\u30c7\u30fc\u30bf\u3092\u96c6\u8a08\u3057\u307e\u3059\u3002<\/span><\/p>\r\n<p><img decoding=\"async\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.11.18.png\" alt=\"\" width=\"1476\" height=\"304\" class=\"alignnone size-full wp-image-4440\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.11.18.png 1476w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.11.18-300x62.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.11.18-1024x211.png 1024w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2024\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2024-02-02-11.11.18-768x158.png 768w\" sizes=\"(max-width: 1476px) 100vw, 1476px\" \/><\/p>\r\n<b><span style=\"color: #ff0000\"><strong><span style=\"font-family: arial, helvetica, sans-serif\">\u300c_finance__models.yml\u300d<\/span><\/strong><\/span><\/b>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-yaml\"><\/code><\/span><\/pre>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>version: 2\r\n\r\nmodels:\r\n  - name: orders\r\n    description: \"\u30b9\u30fc\u30d1\u30fc\u30de\u30fc\u30b1\u30c3\u30c8\u306e\u6ce8\u6587\u30c7\u30fc\u30bf\u3092\u96c6\u8a08\u3057\u305f\u30c7\u30fc\u30bf\u30de\u30fc\u30c8\"\r\n    columns:\r\n      - name: order_id\r\n        description: \"\u6ce8\u6587\u306e\u4e00\u610f\u8b58\u5225\u5b50\"\r\n      - name: order_date\r\n        description: \"\u6ce8\u6587\u65e5\"\r\n      - name: customer_id\r\n        description: \"\u6ce8\u6587\u3092\u884c\u3063\u305f\u9867\u5ba2\u306eID\"\r\n      - name: total_order_amount\r\n        description: \"\u6ce8\u6587\u306e\u5408\u8a08\u91d1\u984d\"\r\n<\/code><\/pre>\r\n<\/div>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-yaml\"><\/code><\/span><\/pre>\r\n<b><span style=\"font-family: arial, helvetica, sans-serif;color: #ff0000\">\u300corders.sql\u300d<\/span><\/b>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-sql\"><\/code><\/span><\/pre>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-sql\" data-lang=\"SQL\"><code>SELECT\r\n    o.order_id,\r\n    o.order_date,\r\n    c.customer_id,\r\n    SUM(o.total_amount) AS total_order_amount\r\nFROM stg_supermarket__orders AS o\r\nJOIN stg_supermarket__customers AS c ON o.customer_id = c.customer_id\r\nGROUP BY o.order_id, o.order_date, c.customer_id<\/code><\/pre>\r\n<\/div>\r\n<pre><span style=\"font-family: arial, helvetica, sans-serif\"><code class=\"language-sql\"><\/code><\/span><\/pre>\r\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u3053\u306e\u30c7\u30fc\u30bf\u30de\u30fc\u30c8\u30e2\u30c7\u30eb\u3067\u306f\u3001\u6ce8\u6587\u30c7\u30fc\u30bf\u3068\u9867\u5ba2\u30c7\u30fc\u30bf\u3092\u7d50\u5408\u3057\u3001\u6ce8\u6587\u3054\u3068\u306e\u5408\u8a08\u91d1\u984d\u3068\u9867\u5ba2\u60c5\u5831\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/span><\/p>\r\n<p><!-- notionvc: 35e55e7e-9cdf-464f-b651-cc5bc4fc8a47 --><\/p>\r\n<p>&nbsp;<\/p>\r\n<p><!-- notionvc: 78bccedc-e3ac-4325-a3b4-b40ef21aba3c --><\/p>\r\n<p><!-- notionvc: 21a0db92-35de-4479-93af-462ff31b6716 --><\/p>\r\n<p><!-- notionvc: 5372a37d-a86f-4113-b353-9f11f549f233 --><\/p>\n\n<h2>\u307e\u3068\u3081<\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif\">\u4eca\u56de\u306f\u3001<span data-token-index=\"1\" class=\"notion-enable-hover\">supermarket_retail<\/span> \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u3001\u5c0f\u58f2\u696d\u306e\u30c7\u30fc\u30bf\u30e2\u30c7\u30ea\u30f3\u30b0\u306b\u7279\u5316\u3057\u305fdbt\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u69cb\u6210\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u305f\u3002\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3001\u4e2d\u9593\u3001\u30de\u30fc\u30c8\u306e\u5404\u5c64\u3092\u5206\u5272\u3057\u3066\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u306e\u54c1\u8cea\u3068\u30c8\u30ec\u30fc\u30b5\u30d3\u30ea\u30c6\u30a3\u30fc\u3092\u78ba\u4fdd\u3057\u3001\u30d3\u30b8\u30cd\u30b9\u306e\u5206\u6790\u30cb\u30fc\u30ba\u306b\u5fdc\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/span><!-- notionvc: 9b6f7b62-155b-4f39-b214-1638f90f05e1 --><\/p>","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u58f2\u696d\u754c\u306f\u81a8\u5927\u306a\u91cf\u306e\u53d6\u5f15\u30c7\u30fc\u30bf\u3092\u65e5\u3005\u751f\u6210\u3057\u3066\u304a\u308a\u3001\u3053\u306e\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u5206\u6790\u3057\u3001\u30d3\u30b8\u30cd\u30b9\u306e\u610f\u601d\u6c7a\u5b9a\u306b\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002dbt (data build tool) \u306f\u3001\u30c7\u30fc\u30bf\u30e2\u30c7\u30ea\u30f3\u30b0\u30d7\u30ed\u30bb\u30b9\u3092\u52b9\u7387\u5316\u3057\u3001\u30c7\u30fc\u30bf\u306e\u5909\u63db\u3092 [&hellip;]<\/p>\n","protected":false},"author":87,"featured_media":4358,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","swell_btn_cv_data":"","footnotes":"","_wp_rev_ctl_limit":""},"categories":[1246],"tags":[491,490,486,489,548],"class_list":["post-4437","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-infrastructure","tag-dbt","tag-elt","tag-486","tag-489","tag-548"],"_links":{"self":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/4437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/comments?post=4437"}],"version-history":[{"count":0,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/4437\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media\/4358"}],"wp:attachment":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media?parent=4437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/categories?post=4437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/tags?post=4437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}