jpskill.com
💼 ビジネス コミュニティ 🟡 少し慣れが必要 👤 経営者・事業責任者・マーケ

💼 AzureデータTablesPy

azure-data-tables-py

Azureのテーブルサービス(NoSQLデータベース)をPython

⏱ 求人原稿の改善 半日 → 15分

📺 まず動画で見る(YouTube)

▶ 【自動化】AIガチ勢の最新活用術6選がこれ1本で丸分かり!【ClaudeCode・AIエージェント・AI経営・Skills・MCP】 ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Azure Tables SDK for Python (Storage and Cosmos DB). Use for NoSQL key-value storage, entity CRUD, and batch operations.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Azureのテーブルサービス(NoSQLデータベース)をPython

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して azure-data-tables-py.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → azure-data-tables-py フォルダができる
  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-17
取得日時
2026-05-17
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • Azure Data Tables Py で、私のビジネスを分析して改善案を3つ提案して
  • Azure Data Tables Py を使って、来週の会議用の資料を作って
  • Azure Data Tables Py で、現状の課題を整理してアクションプランに落として

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

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

Python 用 Azure Tables SDK

構造化データ用の NoSQL キーバリューストア (Azure Storage Tables または Cosmos DB Table API) です。

インストール

pip install azure-data-tables azure-identity

環境変数

# Azure Storage Tables
AZURE_STORAGE_ACCOUNT_URL=https://<account>.table.core.windows.net

# Cosmos DB Table API
COSMOS_TABLE_ENDPOINT=https://<account>.table.cosmos.azure.com

認証

from azure.identity import DefaultAzureCredential
from azure.data.tables import TableServiceClient, TableClient

credential = DefaultAzureCredential()
endpoint = "https://<account>.table.core.windows.net"

# サービス クライアント (テーブルの管理)
service_client = TableServiceClient(endpoint=endpoint, credential=credential)

# テーブル クライアント (エンティティの操作)
table_client = TableClient(endpoint=endpoint, table_name="mytable", credential=credential)

クライアントの種類

クライアント 目的
TableServiceClient テーブルの作成/削除、テーブルの一覧表示
TableClient エンティティの CRUD、クエリ

テーブル操作

# テーブルの作成
service_client.create_table("mytable")

# 存在しない場合に作成
service_client.create_table_if_not_exists("mytable")

# テーブルの削除
service_client.delete_table("mytable")

# テーブルの一覧表示
for table in service_client.list_tables():
    print(table.name)

# テーブル クライアントの取得
table_client = service_client.get_table_client("mytable")

エンティティ操作

重要: すべてのエンティティには PartitionKeyRowKey が必要です (これらが組み合わさって一意の ID を形成します)。

エンティティの作成

entity = {
    "PartitionKey": "sales",
    "RowKey": "order-001",
    "product": "Widget",
    "quantity": 5,
    "price": 9.99,
    "shipped": False
}

# 作成 (存在する場合は失敗)
table_client.create_entity(entity=entity)

# Upsert (作成または置換)
table_client.upsert_entity(entity=entity)

エンティティの取得

# キーによる取得 (最速)
entity = table_client.get_entity(
    partition_key="sales",
    row_key="order-001"
)
print(f"Product: {entity['product']}")

エンティティの更新

# エンティティ全体を置換
entity["quantity"] = 10
table_client.update_entity(entity=entity, mode="replace")

# マージ (特定のフィールドのみを更新)
update = {
    "PartitionKey": "sales",
    "RowKey": "order-001",
    "shipped": True
}
table_client.update_entity(entity=update, mode="merge")

エンティティの削除

table_client.delete_entity(
    partition_key="sales",
    row_key="order-001"
)

エンティティのクエリ

パーティション内のクエリ

# パーティションによるクエリ (効率的)
entities = table_client.query_entities(
    query_filter="PartitionKey eq 'sales'"
)
for entity in entities:
    print(entity)

フィルターによるクエリ

# プロパティによるフィルター
entities = table_client.query_entities(
    query_filter="PartitionKey eq 'sales' and quantity gt 3"
)

# パラメーター付き (より安全)
entities = table_client.query_entities(
    query_filter="PartitionKey eq @pk and price lt @max_price",
    parameters={"pk": "sales", "max_price": 50.0}
)

特定のプロパティの選択

entities = table_client.query_entities(
    query_filter="PartitionKey eq 'sales'",
    select=["RowKey", "product", "price"]
)

すべてのエンティティの一覧表示

# すべての一覧表示 (クロスパーティション - 控えめに使用してください)
for entity in table_client.list_entities():
    print(entity)

バッチ操作

from azure.data.tables import TableTransactionError

# バッチ操作 (同じパーティションのみ!)
operations = [
    ("create", {"PartitionKey": "batch", "RowKey": "1", "data": "first"}),
    ("create", {"PartitionKey": "batch", "RowKey": "2", "data": "second"}),
    ("upsert", {"PartitionKey": "batch", "RowKey": "3", "data": "third"}),
]

try:
    table_client.submit_transaction(operations)
except TableTransactionError as e:
    print(f"Transaction failed: {e}")

非同期クライアント

from azure.data.tables.aio import TableServiceClient, TableClient
from azure.identity.aio import DefaultAzureCredential

async def table_operations():
    credential = DefaultAzureCredential()

    async with TableClient(
        endpoint="https://<account>.table.core.windows.net",
        table_name="mytable",
        credential=credential
    ) as client:
        # 作成
        await client.create_entity(entity={
            "PartitionKey": "async",
            "RowKey": "1",
            "data": "test"
        })

        # クエリ
        async for entity in client.query_entities("PartitionKey eq 'async'"):
            print(entity)

import asyncio
asyncio.run(table_operations())

データ型

Python 型 Table Storage 型
str String
int Int64
float Double
bool Boolean
datetime DateTime
bytes Binary
UUID Guid

ベストプラクティス

  1. クエリパターンと均等な分散のためにパーティションキーを設計してください。
  2. 可能な限りパーティション内でクエリしてください (クロスパーティションはコストがかかります)。
  3. 同じパーティション内の複数のエンティティにはバッチ操作を使用してください。
  4. 冪等な書き込みにはupsert_entity を使用してください。
  5. インジェクションを防ぐためにパラメーター化されたクエリを使用してください。
  6. エンティティは小さく保ってください — エンティティあたり最大 1MB です。
  7. 高スループットのシナリオには非同期クライアントを使用してください。

使用するタイミング

このスキルは、概要に記載されているワークフローまたはアクションを実行するのに適用できます。

制限事項

  • このスキルは、タスクが上記の範囲と明確に一致する場合にのみ使用してください。
  • 出力を、環境固有の検証、テスト、または専門家によるレビューの代わりとして扱わないでください。
  • 必要な入力、アクセス許可、安全境界、または成功基準が不足している場合は、停止して説明を求めてください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Azure Tables SDK for Python

NoSQL key-value store for structured data (Azure Storage Tables or Cosmos DB Table API).

Installation

pip install azure-data-tables azure-identity

Environment Variables

# Azure Storage Tables
AZURE_STORAGE_ACCOUNT_URL=https://<account>.table.core.windows.net

# Cosmos DB Table API
COSMOS_TABLE_ENDPOINT=https://<account>.table.cosmos.azure.com

Authentication

from azure.identity import DefaultAzureCredential
from azure.data.tables import TableServiceClient, TableClient

credential = DefaultAzureCredential()
endpoint = "https://<account>.table.core.windows.net"

# Service client (manage tables)
service_client = TableServiceClient(endpoint=endpoint, credential=credential)

# Table client (work with entities)
table_client = TableClient(endpoint=endpoint, table_name="mytable", credential=credential)

Client Types

Client Purpose
TableServiceClient Create/delete tables, list tables
TableClient Entity CRUD, queries

Table Operations

# Create table
service_client.create_table("mytable")

# Create if not exists
service_client.create_table_if_not_exists("mytable")

# Delete table
service_client.delete_table("mytable")

# List tables
for table in service_client.list_tables():
    print(table.name)

# Get table client
table_client = service_client.get_table_client("mytable")

Entity Operations

Important: Every entity requires PartitionKey and RowKey (together form unique ID).

Create Entity

entity = {
    "PartitionKey": "sales",
    "RowKey": "order-001",
    "product": "Widget",
    "quantity": 5,
    "price": 9.99,
    "shipped": False
}

# Create (fails if exists)
table_client.create_entity(entity=entity)

# Upsert (create or replace)
table_client.upsert_entity(entity=entity)

Get Entity

# Get by key (fastest)
entity = table_client.get_entity(
    partition_key="sales",
    row_key="order-001"
)
print(f"Product: {entity['product']}")

Update Entity

# Replace entire entity
entity["quantity"] = 10
table_client.update_entity(entity=entity, mode="replace")

# Merge (update specific fields only)
update = {
    "PartitionKey": "sales",
    "RowKey": "order-001",
    "shipped": True
}
table_client.update_entity(entity=update, mode="merge")

Delete Entity

table_client.delete_entity(
    partition_key="sales",
    row_key="order-001"
)

Query Entities

Query Within Partition

# Query by partition (efficient)
entities = table_client.query_entities(
    query_filter="PartitionKey eq 'sales'"
)
for entity in entities:
    print(entity)

Query with Filters

# Filter by properties
entities = table_client.query_entities(
    query_filter="PartitionKey eq 'sales' and quantity gt 3"
)

# With parameters (safer)
entities = table_client.query_entities(
    query_filter="PartitionKey eq @pk and price lt @max_price",
    parameters={"pk": "sales", "max_price": 50.0}
)

Select Specific Properties

entities = table_client.query_entities(
    query_filter="PartitionKey eq 'sales'",
    select=["RowKey", "product", "price"]
)

List All Entities

# List all (cross-partition - use sparingly)
for entity in table_client.list_entities():
    print(entity)

Batch Operations

from azure.data.tables import TableTransactionError

# Batch operations (same partition only!)
operations = [
    ("create", {"PartitionKey": "batch", "RowKey": "1", "data": "first"}),
    ("create", {"PartitionKey": "batch", "RowKey": "2", "data": "second"}),
    ("upsert", {"PartitionKey": "batch", "RowKey": "3", "data": "third"}),
]

try:
    table_client.submit_transaction(operations)
except TableTransactionError as e:
    print(f"Transaction failed: {e}")

Async Client

from azure.data.tables.aio import TableServiceClient, TableClient
from azure.identity.aio import DefaultAzureCredential

async def table_operations():
    credential = DefaultAzureCredential()

    async with TableClient(
        endpoint="https://<account>.table.core.windows.net",
        table_name="mytable",
        credential=credential
    ) as client:
        # Create
        await client.create_entity(entity={
            "PartitionKey": "async",
            "RowKey": "1",
            "data": "test"
        })

        # Query
        async for entity in client.query_entities("PartitionKey eq 'async'"):
            print(entity)

import asyncio
asyncio.run(table_operations())

Data Types

Python Type Table Storage Type
str String
int Int64
float Double
bool Boolean
datetime DateTime
bytes Binary
UUID Guid

Best Practices

  1. Design partition keys for query patterns and even distribution
  2. Query within partitions whenever possible (cross-partition is expensive)
  3. Use batch operations for multiple entities in same partition
  4. Use upsert_entity for idempotent writes
  5. Use parameterized queries to prevent injection
  6. Keep entities small — max 1MB per entity
  7. Use async client for high-throughput scenarios

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.