Q. dbt Cloudはデータウェアハウスにアクセスしたデータを保持するのか? #dbt

2024.02.14

小ネタです。

タイトルに記載の『dbt Cloudはデータウェアハウスにアクセスした際、そのデータを(dbt Cloud環境の)内部に保持しているのか否か』という点。こちらはdbt Cloudを使っていて個人的に思っていた部分でもあり、また同様の問い合わせを複数のお客様から伺うこともありました。

『dbt Cloudではこういう感じですよ』という記載を幾つかのページで確認することが出来たので、FAQ的な情報としてその辺りのポイントを当エントリにまとめておこうと思います。

 

A. 保持しません

正確に言うと「データは永続化されることはなく、セッション中はインスタンスのメモリ内にのみ存在する(セッションが切れたら消える)」という形になります。下記公式ページにその記載を見つけることが出来ました。

Data warehouse interaction(データウェアハウスの相互作用)
dbt Cloud's primary role is as a data processor, not a data store. The dbt Cloud application enables users to dispatch SQL to the warehouse for transformation. However, users can post SQL that returns customer data into the dbt Cloud application. This data never persists and will only exist in memory on the instance for the duration of the session. To lock down customer data correctly, proper data warehouse permissions must be applied to prevent improper access or storage of sensitive data.
(dbt Cloud の主な役割は、データ ストアではなく、データ プロセッサとしてです。 dbt クラウド アプリケーションを使用すると、ユーザーは変換のために SQL をウェアハウスにディスパッチできます。 ただし、ユーザーは顧客データを返す SQLをdbtクラウドアプリケーションに投稿できます。このデータは永続化されることはなく、セッション中はインスタンスのメモリ内にのみ存在します。顧客データを正しくロックダウンするには、適切なデータウェアハウス権限を適用して、機密データへの不適切なアクセスや保存を防ぐ必要があります。)

dbt Cloud Architecture | dbt Developer Hub

また、派生する形で以下dbtのコミュニティフォーラム内のスレッドにて「ではdbt Cloudは何を保持しているのか?」という部分の問に答えています。2019年時点の投稿なので若干情報としては古いですが、基本的な部分は変わらないかなと思います。保存するものはあるがそれはデータウェアハウスのデータに関するものではなく、またdbt Cloudインフラの中にもデータを永続化する仕組み・ステップはないと言及されています。

(前略)
At the moment, dbt Cloud stores the following data persistently:
(現時点では、dbt Cloud は次のデータを永続的に保存します。)

1. your dbt Cloud account information. things like job definitions, database connection information, users, etc.
(dbt Cloudのアカウントに関する情報。 ジョブ定義、データベース接続情報、ユーザーなど)
2.logs associated with jobs and interactive queries you’ve run.
(実行したジョブと対話型クエリに関連付けられたログ)
3.your dbt “assets”: things like run_results.json and manifest.json.
(dbt環境における「アセット」: run_results.jsonやmanifest.jsonなど)

In #1, we can be sure that this does not include any raw data from your warehouse because we know exactly what type of information is stored here. For #2 and #3, that gets just slightly more complicated, because you control these assets.
(#1 では、ここにどのような種類の情報が保存されているかを正確に把握しているため、ウェアハウスからの生データが含まれていないことを確認できます。 #2と#3の場合は、これらの資産を制御するため、少しだけ複雑になります。)

Here’s one example: it’s totally possible to write dbt code fetches all customer data from your customers table and then writes it out to the logs. This is almost definitely a bad idea, but it is possible to do. If one were to write this code, the logs would contain all customer data and therefore dbt Cloud would store it.
(一例を示すと、顧客テーブルからすべての顧客データをフェッチし、それをログに書き出す dbtコードを作成することは可能です。 これはほぼ間違いなく悪いアイデアですが、実行することは可能です。 このコードを作成すると、ログにはすべての顧客データが含まれるため、dbt Cloud がそれを保存します。)

So, the more complicated answer is “no, dbt Cloud doesn’t store you data from your warehouse unless you specifically write some particular piece of code that will cause that data to be written to the logs, or to a compiled dbt asset.”
(従って、より複雑な答えは、「いいえ、データをログまたはコンパイルされた dbt アセットに書き込む特定のコードを特に記述しない限り、dbt Cloud はウェアハウスからデータを保存しません。」となります。)

Finally, dbt Cloud does have data from your warehouse pass through its infrastructure when writing interactive queries in the IDE. If you write select * from customers limit 100, the data from your customers table will pass through the dbt Cloud infrastructure on the way to your browser. At the moment, there are no steps in that process that persist the data: dbt Cloud doesn’t perform any caching or other behavior whereby that data lives on our servers outside of your browser session.
(最後に、dbt Cloud では、IDEでインタラクティブなクエリを作成するときに、ウェアハウスからのデータがそのインフラストラクチャを通過します。 select * from Customers limit 100と記述すると、customers テーブルのデータはブラウザに送信される途中で dbt Cloudインフラストラクチャを通過します。 現時点では、そのプロセスにはデータを永続化するステップはありません。dbt Cloud は、データがブラウザー セッション外のサーバー上に存在するキャッシュやその他の動作を実行しません。)

:
:
(後略)

Does dbt Cloud store any source data? - In-Depth Discussions - dbt Community Forum

上記スレッドでは合わせてセキュリティに関するページもご参照くださいとありますので合わせてページ情報を添えておきます。

 

まとめ

という訳でdbt Cloudは内部にアクセスしたデータウェアハウスのデータを保持するのか?という問いに関する答えをまとめた内容のご紹介でした。この点について気になっていた方々の疑問が解消されたのであれば幸いです。