[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-cc62606a-5e1c-497e-acd9-13f422104672":3,"$fqSqoj4qSrmsNwShRf2uot1oOyEhnwbHc_HSNbxht-YQ":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"cc62606a-5e1c-497e-acd9-13f422104672","azure-data-tables-java","使用Azure Tables SDK for Java构建表存储应用程序。与Azure Table Storage和Cosmos DB Table API兼容。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: azure-data-tables-java\ndescription: \"Build table storage applications using the Azure Tables SDK for Java. Works with both Azure Table Storage and Cosmos DB Table API.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Azure Tables SDK for Java\n\nBuild table storage applications using the Azure Tables SDK for Java. Works with both Azure Table Storage and Cosmos DB Table API.\n\n## Installation\n\n```xml\n\u003Cdependency>\n  \u003CgroupId>com.azure\u003C\u002FgroupId>\n  \u003CartifactId>azure-data-tables\u003C\u002FartifactId>\n  \u003Cversion>12.6.0-beta.1\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n## Client Creation\n\n### With Connection String\n\n```java\nimport com.azure.data.tables.TableServiceClient;\nimport com.azure.data.tables.TableServiceClientBuilder;\nimport com.azure.data.tables.TableClient;\n\nTableServiceClient serviceClient = new TableServiceClientBuilder()\n    .connectionString(\"\u003Cyour-connection-string>\")\n    .buildClient();\n```\n\n### With Shared Key\n\n```java\nimport com.azure.core.credential.AzureNamedKeyCredential;\n\nAzureNamedKeyCredential credential = new AzureNamedKeyCredential(\n    \"\u003Caccount-name>\",\n    \"\u003Caccount-key>\");\n\nTableServiceClient serviceClient = new TableServiceClientBuilder()\n    .endpoint(\"\u003Cyour-table-account-url>\")\n    .credential(credential)\n    .buildClient();\n```\n\n### With SAS Token\n\n```java\nTableServiceClient serviceClient = new TableServiceClientBuilder()\n    .endpoint(\"\u003Cyour-table-account-url>\")\n    .sasToken(\"\u003Csas-token>\")\n    .buildClient();\n```\n\n### With DefaultAzureCredential (Storage only)\n\n```java\nimport com.azure.identity.DefaultAzureCredentialBuilder;\n\nTableServiceClient serviceClient = new TableServiceClientBuilder()\n    .endpoint(\"\u003Cyour-table-account-url>\")\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .buildClient();\n```\n\n## Key Concepts\n\n- **TableServiceClient**: Manage tables (create, list, delete)\n- **TableClient**: Manage entities within a table (CRUD)\n- **Partition Key**: Groups entities for efficient queries\n- **Row Key**: Unique identifier within a partition\n- **Entity**: A row with up to 252 properties (1MB Storage, 2MB Cosmos)\n\n## Core Patterns\n\n### Create Table\n\n```java\n\u002F\u002F Create table (throws if exists)\nTableClient tableClient = serviceClient.createTable(\"mytable\");\n\n\u002F\u002F Create if not exists (no exception)\nTableClient tableClient = serviceClient.createTableIfNotExists(\"mytable\");\n```\n\n### Get Table Client\n\n```java\n\u002F\u002F From service client\nTableClient tableClient = serviceClient.getTableClient(\"mytable\");\n\n\u002F\u002F Direct construction\nTableClient tableClient = new TableClientBuilder()\n    .connectionString(\"\u003Cconnection-string>\")\n    .tableName(\"mytable\")\n    .buildClient();\n```\n\n### Create Entity\n\n```java\nimport com.azure.data.tables.models.TableEntity;\n\nTableEntity entity = new TableEntity(\"partitionKey\", \"rowKey\")\n    .addProperty(\"Name\", \"Product A\")\n    .addProperty(\"Price\", 29.99)\n    .addProperty(\"Quantity\", 100)\n    .addProperty(\"IsAvailable\", true);\n\ntableClient.createEntity(entity);\n```\n\n### Get Entity\n\n```java\nTableEntity entity = tableClient.getEntity(\"partitionKey\", \"rowKey\");\n\nString name = (String) entity.getProperty(\"Name\");\nDouble price = (Double) entity.getProperty(\"Price\");\nSystem.out.printf(\"Product: %s, Price: %.2f%n\", name, price);\n```\n\n### Update Entity\n\n```java\nimport com.azure.data.tables.models.TableEntityUpdateMode;\n\n\u002F\u002F Merge (update only specified properties)\nTableEntity updateEntity = new TableEntity(\"partitionKey\", \"rowKey\")\n    .addProperty(\"Price\", 24.99);\ntableClient.updateEntity(updateEntity, TableEntityUpdateMode.MERGE);\n\n\u002F\u002F Replace (replace entire entity)\nTableEntity replaceEntity = new TableEntity(\"partitionKey\", \"rowKey\")\n    .addProperty(\"Name\", \"Product A Updated\")\n    .addProperty(\"Price\", 24.99)\n    .addProperty(\"Quantity\", 150);\ntableClient.updateEntity(replaceEntity, TableEntityUpdateMode.REPLACE);\n```\n\n### Upsert Entity\n\n```java\n\u002F\u002F Insert or update (merge mode)\ntableClient.upsertEntity(entity, TableEntityUpdateMode.MERGE);\n\n\u002F\u002F Insert or replace\ntableClient.upsertEntity(entity, TableEntityUpdateMode.REPLACE);\n```\n\n### Delete Entity\n\n```java\ntableClient.deleteEntity(\"partitionKey\", \"rowKey\");\n```\n\n### List Entities\n\n```java\nimport com.azure.data.tables.models.ListEntitiesOptions;\n\n\u002F\u002F List all entities\nfor (TableEntity entity : tableClient.listEntities()) {\n    System.out.printf(\"%s - %s%n\",\n        entity.getPartitionKey(),\n        entity.getRowKey());\n}\n\n\u002F\u002F With filtering and selection\nListEntitiesOptions options = new ListEntitiesOptions()\n    .setFilter(\"PartitionKey eq 'sales'\")\n    .setSelect(\"Name\", \"Price\");\n\nfor (TableEntity entity : tableClient.listEntities(options, null, null)) {\n    System.out.printf(\"%s: %.2f%n\",\n        entity.getProperty(\"Name\"),\n        entity.getProperty(\"Price\"));\n}\n```\n\n### Query with OData Filter\n\n```java\n\u002F\u002F Filter by partition key\nListEntitiesOptions options = new ListEntitiesOptions()\n    .setFilter(\"PartitionKey eq 'electronics'\");\n\n\u002F\u002F Filter with multiple conditions\noptions.setFilter(\"PartitionKey eq 'electronics' and Price gt 100\");\n\n\u002F\u002F Filter with comparison operators\noptions.setFilter(\"Quantity ge 10 and Quantity le 100\");\n\n\u002F\u002F Top N results\noptions.setTop(10);\n\nfor (TableEntity entity : tableClient.listEntities(options, null, null)) {\n    System.out.println(entity.getRowKey());\n}\n```\n\n### Batch Operations (Transactions)\n\n```java\nimport com.azure.data.tables.models.TableTransactionAction;\nimport com.azure.data.tables.models.TableTransactionActionType;\nimport java.util.Arrays;\n\n\u002F\u002F All entities must have same partition key\nList\u003CTableTransactionAction> actions = Arrays.asList(\n    new TableTransactionAction(\n        TableTransactionActionType.CREATE,\n        new TableEntity(\"batch\", \"row1\").addProperty(\"Name\", \"Item 1\")),\n    new TableTransactionAction(\n        TableTransactionActionType.CREATE,\n        new TableEntity(\"batch\", \"row2\").addProperty(\"Name\", \"Item 2\")),\n    new TableTransactionAction(\n        TableTransactionActionType.UPSERT_MERGE,\n        new TableEntity(\"batch\", \"row3\").addProperty(\"Name\", \"Item 3\"))\n);\n\ntableClient.submitTransaction(actions);\n```\n\n### List Tables\n\n```java\nimport com.azure.data.tables.models.TableItem;\nimport com.azure.data.tables.models.ListTablesOptions;\n\n\u002F\u002F List all tables\nfor (TableItem table : serviceClient.listTables()) {\n    System.out.println(table.getName());\n}\n\n\u002F\u002F Filter tables\nListTablesOptions options = new ListTablesOptions()\n    .setFilter(\"TableName eq 'mytable'\");\n\nfor (TableItem table : serviceClient.listTables(options, null, null)) {\n    System.out.println(table.getName());\n}\n```\n\n### Delete Table\n\n```java\nserviceClient.deleteTable(\"mytable\");\n```\n\n## Typed Entities\n\n```java\npublic class Product implements TableEntity {\n    private String partitionKey;\n    private String rowKey;\n    private OffsetDateTime timestamp;\n    private String eTag;\n    private String name;\n    private double price;\n    \n    \u002F\u002F Getters and setters for all fields\n    @Override\n    public String getPartitionKey() { return partitionKey; }\n    @Override\n    public void setPartitionKey(String partitionKey) { this.partitionKey = partitionKey; }\n    @Override\n    public String getRowKey() { return rowKey; }\n    @Override\n    public void setRowKey(String rowKey) { this.rowKey = rowKey; }\n    \u002F\u002F ... other getters\u002Fsetters\n    \n    public String getName() { return name; }\n    public void setName(String name) { this.name = name; }\n    public double getPrice() { return price; }\n    public void setPrice(double price) { this.price = price; }\n}\n\n\u002F\u002F Usage\nProduct product = new Product();\nproduct.setPartitionKey(\"electronics\");\nproduct.setRowKey(\"laptop-001\");\nproduct.setName(\"Laptop\");\nproduct.setPrice(999.99);\n\ntableClient.createEntity(product);\n```\n\n## Error Handling\n\n```java\nimport com.azure.data.tables.models.TableServiceException;\n\ntry {\n    tableClient.createEntity(entity);\n} catch (TableServiceException e) {\n    System.out.println(\"Status: \" + e.getResponse().getStatusCode());\n    System.out.println(\"Error: \" + e.getMessage());\n    \u002F\u002F 409 = Conflict (entity exists)\n    \u002F\u002F 404 = Not Found\n}\n```\n\n## Environment Variables\n\n```bash\n# Storage Account\nAZURE_TABLES_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=...\nAZURE_TABLES_ENDPOINT=https:\u002F\u002F\u003Caccount>.table.core.windows.net\n\n# Cosmos DB Table API\nCOSMOS_TABLE_ENDPOINT=https:\u002F\u002F\u003Caccount>.table.cosmosdb.azure.com\n```\n\n## Best Practices\n\n1. **Partition Key Design**: Choose keys that distribute load evenly\n2. **Batch Operations**: Use transactions for atomic multi-entity updates\n3. **Query Optimization**: Always filter by PartitionKey when possible\n4. **Select Projection**: Only select needed properties for performance\n5. **Entity Size**: Keep entities under 1MB (Storage) or 2MB (Cosmos)\n\n## Trigger Phrases\n\n- \"Azure Tables Java\"\n- \"table storage SDK\"\n- \"Cosmos DB Table API\"\n- \"NoSQL key-value storage\"\n- \"partition key row key\"\n- \"table entity CRUD\"\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,91,1968,"2026-05-16 13:06:11",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"08ffa24e-5266-4b30-b530-0e7bc2cb2168","1.0.0","azure-data-tables-java.zip",2899,"uploads\u002Fskills\u002Fcc62606a-5e1c-497e-acd9-13f422104672\u002Fazure-data-tables-java.zip","272e54090c65ec80edba79e6f957529e24e75b76b76ece88853de2a51bbdbcb2","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":9316}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]