jpskill.com
🛠️ 開発・MCP コミュニティ

wap-ingestion

Ingest data from S3 into bauplan using the Write-Audit-Publish pattern for safe data loading. Use when loading new data from S3, performing safe data ingestion, or when the user mentions WAP, data ingestion, importing parquet/csv/jsonl files, or needs to safely load data with quality checks.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o wap-ingestion.zip https://jpskill.com/download/17481.zip && unzip -o wap-ingestion.zip && rm wap-ingestion.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17481.zip -OutFile "$d\wap-ingestion.zip"; Expand-Archive "$d\wap-ingestion.zip" -DestinationPath $d -Force; ri "$d\wap-ingestion.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して wap-ingestion.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → wap-ingestion フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Write-Audit-Publish (WAP) パターン

bauplan SDK を使用して Python スクリプトを記述し、WAP を実装します。CLI コマンドは使用しないでください。

3 つのステップ: Write (一時ブランチへの取り込み) → Audit (品質チェック) → Publish (main へのマージ)

ブランチの安全性: すべての操作は一時ブランチで行われ、決して main では行われません。デフォルトでは、ブランチは成功または失敗後も検査のために開いたままになります。

アトミックな複数テーブル操作: merge_branch はアトミックです。ブランチ上で複数のテーブルを作成または変更でき、マージ時には、すべての変更が main に適用されるか、何も適用されないかのいずれかになります。これにより、安全な複数テーブル取り込みワークフローが可能になります。

必須のユーザー入力

WAP スクリプトを記述する前に、以下のパラメータをユーザーに必ず尋ねる必要があります。

  1. S3 path (必須): ソースデータの S3 URI パターン (例: s3://bucket/path/*.parquet)
  2. Table name (必須): ターゲットテーブルの名前
  3. On success behavior (オプション):
    • inspect (デフォルト): マージ前にユーザーが検査できるようにブランチを開いたままにします
    • merge: 自動的に main にマージし、ブランチを削除します
  4. On failure behavior (オプション):
    • keep (デフォルト): 検査/デバッグのためにブランチを開いたままにします
    • delete: 失敗したブランチを削除します

WAP スクリプトテンプレート

完全なテンプレートについては、wap_template.py を参照してください。最小限の使用例:

from wap_template import wap_ingest

branch, success = wap_ingest(
    table_name="orders",
    s3_path="s3://my-bucket/data/*.parquet",
    namespace="bauplan",
    on_success="inspect",  # or "merge"
    on_failure="keep"      # or "delete"
)

主要な SDK メソッド

メソッド 説明
bauplan.Client() bauplan クライアントを初期化します
client.info() クライアント情報を取得します。.user.username を介してユーザー名にアクセスします
client.create_branch(name, from_ref="main") 指定された ref から新しいブランチを作成します
client.has_branch(name) ブランチが存在するかどうかを確認します
client.delete_branch(name) ブランチを削除します
client.create_table(table, search_uri, ...) S3 から推測されたスキーマでテーブルを作成します
client.import_data(table, search_uri, ...) S3 からテーブルにデータをインポートします
client.query(query, ref) SQL クエリを実行し、PyArrow Table を返します
client.merge_branch(source_ref, into_branch) ブランチをターゲットにマージします
client.has_table(table, ref, namespace) ブランチにテーブルが存在するかどうかを確認します

SDK リファレンス: 詳細なメソッドシグネチャについては、https://docs.bauplanlabs.com/reference/bauplan を確認してください。

ワークフローチェックリスト

コピーして進捗状況を追跡します。

WAP Progress:
- [ ] Ask user for: S3 path, table name, on_success, on_failure
- [ ] Write script using wap_template.py
- [ ] Run script: python wap_script.py
- [ ] Verify output shows row count > 0
- [ ] If on_success="inspect": confirm branch ready for review
- [ ] If on_success="merge": confirm merge to main succeeded

出力例

成功した実行 (on_success="inspect"):

$ python wap_script.py
Imported 15234 rows
WAP completed successfully. Branch 'alice.wap_orders_1704067200' ready for inspection.
To merge manually: client.merge_branch(source_ref='alice.wap_orders_1704067200', into_branch='main')

成功した実行 (on_success="merge"):

$ python wap_script.py
Imported 15234 rows
Successfully published orders to main
Cleaned up branch: alice.wap_orders_1704067200

失敗した実行 (on_failure="keep"):

$ python wap_script.py
WAP failed: No data was imported
Branch 'alice.wap_orders_1704067200' preserved for inspection/debugging.

既存のテーブルでの WAP

既存のテーブルにデータを追加するには、create_table をスキップし、import_data のみを呼び出します。

# Table already exists on main - just import new data
client.import_data(
    table=table_name,
    search_uri=s3_path,
    namespace=namespace,
    branch=branch_name
)

これにより、既存のテーブルスキーマに行が追加されます。監査および公開フェーズは同じままです。新しい行は、マージされるまでブランチ上で自動的にサンドボックス化されます。

検査後の CLI マージ

on_success="inspect" (デフォルト) の場合、ブランチはユーザーレビューのために開いたままになります。ユーザーがデータの検査後にマージを要求する場合は、CLI を使用します。

# 1. Checkout to main first (required before merging)
bauplan checkout main

# 2. Merge the WAP branch into main
bauplan branch merge <username>.wap_<table_name>_<timestamp>

# 3. Optionally delete the branch after successful merge
bauplan branch rm <username>.wap_<table_name>_<timestamp>

: bauplan branch merge を実行するには、main にいる必要があります。ブランチ名は、完了時に WAP スクリプトによって出力されます。

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Write-Audit-Publish (WAP) Pattern

Implement WAP by writing a Python script using the bauplan SDK. Do NOT use CLI commands.

The three steps: Write (ingest to temp branch) → Audit (quality checks) → Publish (merge to main)

Branch safety: All operations happen on a temporary branch, NEVER on main. By default, branches are kept open for inspection after success or failure.

Atomic multi-table operations: merge_branch is atomic. You can create or modify multiple tables on a branch, and when you merge, either all changes apply to main or none do. This enables safe multi-table ingestion workflows.

Required User Input

Before writing the WAP script, you MUST ask the user for the following parameters:

  1. S3 path (required): The S3 URI pattern for the source data (e.g., s3://bucket/path/*.parquet)
  2. Table name (required): The name for the target table
  3. On success behavior (optional):
    • inspect (default): Keep the branch open for user inspection before merging
    • merge: Automatically merge to main and delete the branch
  4. On failure behavior (optional):
    • keep (default): Leave the branch open for inspection/debugging
    • delete: Delete the failed branch

WAP Script Template

See wap_template.py for the complete template. Minimal usage:

from wap_template import wap_ingest

branch, success = wap_ingest(
    table_name="orders",
    s3_path="s3://my-bucket/data/*.parquet",
    namespace="bauplan",
    on_success="inspect",  # or "merge"
    on_failure="keep"      # or "delete"
)

Key SDK Methods

Method Description
bauplan.Client() Initialize the bauplan client
client.info() Get client info; access username via .user.username
client.create_branch(name, from_ref="main") Create a new branch from specified ref
client.has_branch(name) Check if branch exists
client.delete_branch(name) Delete a branch
client.create_table(table, search_uri, ...) Create table with schema inferred from S3
client.import_data(table, search_uri, ...) Import data from S3 into table
client.query(query, ref) Run SQL query, returns PyArrow Table
client.merge_branch(source_ref, into_branch) Merge branch into target
client.has_table(table, ref, namespace) Check if table exists on branch

SDK Reference: For detailed method signatures, check https://docs.bauplanlabs.com/reference/bauplan

Workflow Checklist

Copy and track progress:

WAP Progress:
- [ ] Ask user for: S3 path, table name, on_success, on_failure
- [ ] Write script using wap_template.py
- [ ] Run script: python wap_script.py
- [ ] Verify output shows row count > 0
- [ ] If on_success="inspect": confirm branch ready for review
- [ ] If on_success="merge": confirm merge to main succeeded

Example Output

Successful run (on_success="inspect"):

$ python wap_script.py
Imported 15234 rows
WAP completed successfully. Branch 'alice.wap_orders_1704067200' ready for inspection.
To merge manually: client.merge_branch(source_ref='alice.wap_orders_1704067200', into_branch='main')

Successful run (on_success="merge"):

$ python wap_script.py
Imported 15234 rows
Successfully published orders to main
Cleaned up branch: alice.wap_orders_1704067200

Failed run (on_failure="keep"):

$ python wap_script.py
WAP failed: No data was imported
Branch 'alice.wap_orders_1704067200' preserved for inspection/debugging.

WAP on Existing Tables

To append data to an existing table, skip create_table and only call import_data:

# Table already exists on main - just import new data
client.import_data(
    table=table_name,
    search_uri=s3_path,
    namespace=namespace,
    branch=branch_name
)

This appends rows to the existing table schema. The audit and publish phases remain the same: the new rows are automatically sandboxed on the branch until merged.

CLI Merge After Inspection

When on_success="inspect" (default), the branch is left open for user review. If the user asks to merge after inspecting the data, use the CLI:

# 1. Checkout to main first (required before merging)
bauplan checkout main

# 2. Merge the WAP branch into main
bauplan branch merge <username>.wap_<table_name>_<timestamp>

# 3. Optionally delete the branch after successful merge
bauplan branch rm <username>.wap_<table_name>_<timestamp>

Note: You must be on main to run bauplan branch merge. The branch name is printed by the WAP script upon completion.