Metadata-Version: 2.4
Name: dwh-auditor
Version: 0.2.0
Summary: BigQuery cost optimization and governance audit CLI tool
Project-URL: Homepage, https://github.com/shirokurolab/dwh-auditor
Project-URL: Documentation, https://shirokurolab.github.io/dwh-auditor/
Project-URL: Repository, https://github.com/shirokurolab/dwh-auditor
Project-URL: Issues, https://github.com/shirokurolab/dwh-auditor/issues
Author: DWH-Auditor Contributors
License: MIT License
        
        Copyright (c) 2026 shirokurolab
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: audit,bigquery,cli,cost,data-engineering
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Database
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Requires-Dist: google-cloud-bigquery>=3.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.12.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.14.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: furo>=2024.1.29; extra == 'docs'
Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'docs'
Requires-Dist: sphinx>=7.0.0; extra == 'docs'
Description-Content-Type: text/markdown

# 🚀 DWH-Auditor

![PyPI version](https://img.shields.io/badge/pypi-v0.2.0-blue)
![Python Versions](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11-blue)
![License](https://img.shields.io/badge/license-MIT-green)
[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://shirokurolab.github.io/dwh-auditor/)

**📚 公式ドキュメント:** [https://shirokurolab.github.io/dwh-auditor/](https://shirokurolab.github.io/dwh-auditor/)

**DWH-Auditor** は、BigQueryのメタデータを分析し、**「クラウド破産」を防ぐためのコスト最適化とデータガバナンス監査**を瞬時に行うオープンソースのCLIツールです。

「誰がどんな重いクエリを投げているのか」「どのテーブルが使われていないのか」を可視化し、具体的なアクション（インサイト）を提示します。

<p align="center">
  <img src="https://raw.githubusercontent.com/shirokurolab/dwh-auditor/main/docs/assets/sample_output_v0.2.0.png" alt="DWH-Auditor Console Report Sample">
</p>

## 💡 なぜ DWH-Auditor なのか？

BigQueryは非常に強力ですが、従量課金の性質上、たった一つの非効率なクエリや、放置された不要なテーブルが毎月数万円〜数百万円の無駄なコストを生み出すことがあります。

DWH-Auditorは、複雑な設定なしに `INFORMATION_SCHEMA` を解析し、あなたのデータ基盤の「健康診断」を数秒で完了させます。**実際のテーブルデータには一切アクセスしないため、セキュリティの厳しい環境でも安全に実行できます。**

## ✨ 主な機能

- 💸 **高コストクエリの特定:** 過去N日間の課金バイト数を集計し、コストの元凶となっているクエリTop10をリストアップします。
- 🚨 **フルスキャン（アンチパターン）検知:** パーティション指定漏れなど、非効率なフルスキャンクエリを警告します。
- 🧟 **ゾンビテーブルの発見:** 長期間誰からも参照されていないテーブルを特定し、ストレージコストの削減を促します。
- 📊 **Markdownレポート出力:** CI/CD（GitHub Actions等）に組み込み、チーム全体に日次で監査レポートを共有できます。

## 🛠 クイックスタート

### 1. インストール

```bash
pip install dwh-auditor
```

### 2. 初期設定

```bash
dwh-auditor init
```

カレントディレクトリに config.yaml が生成されます。必要に応じてコスト単価やしきい値を調整してください。

### 3. 監査の実行

```bash
# 例: my-gcp-project の過去30日間を分析
dwh-auditor analyze --project my-gcp-project --days 30 --output console
```

### 4. 🔐 セキュリティについて (Zero Data Access)

DWH-Auditor は、BigQueryのメタデータ（INFORMATION_SCHEMA）のみを読み取ります。ユーザーの実際のテーブルデータ（レコードの中身）を読み取ることは一切ありません。 必要なIAM権限は最小限（roles/bigquery.metadataViewer, roles/bigquery.resourceViewer）で動作します。

### 5. 💼 エンタープライズサポート / データ基盤コンサルティング

DWH-Auditor は、データ基盤の「課題を発見する」ための強力な健康診断ツールです。しかし、発見された重症な課題（複雑なデータモデルの再設計や、大規模なクエリのリファクタリング）を自社リソースだけで解決するのが難しいケースも少なくありません。

もし以下のようなお悩みがございましたら、本ツールの開発者（データエンジニア）による直接の支援・コンサルティングをご提供可能です。

「DWH-Auditorで大量のフルスキャンが検知されたが、既存のBIやETLを壊さずにどうパーティション設計を直せばいいか分からない」

「レガシーなSQL群を、dbtを用いたモダンなデータモデリングに移行したい」

「本ツールを自社のCI/CDパイプラインに組み込み、継続的なデータガバナンス体制を構築したい」

### 6. 👉 ご相談・お問い合わせ:

shirokurolab.oss.tools@gmail.com までお気軽にご連絡ください。初回ヒアリング・コスト削減ポテンシャルの簡易アセスメントは無料で承ります。

### 7. 🤝 貢献について (Contributing)

バグ報告、機能追加のPull Requestは大歓迎です！開発環境のセットアップ方法については CONTRIBUTING.md をご覧ください。

### 8. 📜 ライセンス

## MIT License
