azure-data-tables-java
Java 로 Azure Table Storage 애플리케이션 구축
규모에 맞는 구조화된 NoSQL 데이터를 저장해야 하나요? 이 스킬은 적절한 인증과 효율적인 쿼리 패턴을 사용하여 Azure Tables SDK for Java 를 통해 테이블 스토리지 솔루션을 구현하는 데 도움이 됩니다.
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“azure-data-tables-java”。 엔티티 생성 및 충돌 오류 처리
预期结果:
TableEntity entity = new TableEntity("products", "laptop-001").addProperty("Name", "Laptop").addProperty("Price", 999.99);
try {
tableClient.createEntity(entity);
} catch (TableServiceException e) {
if (e.getResponse().getStatusCode() == 409) {
System.out.println("Entity already exists - use upsert instead");
}
}
正在使用“azure-data-tables-java”。 필터 및 투영을 사용한 쿼리
预期结果:
ListEntitiesOptions options = new ListEntitiesOptions()
.setFilter("PartitionKey eq 'electronics' and Price gt 100")
.setSelect("Name", "Price")
.setTop(10);
for (TableEntity entity : tableClient.listEntities(options, null, null)) {
System.out.printf("%s: $%.2f%n", entity.getProperty("Name"), entity.getProperty("Price"));
}
安全审计
安全This skill is safe for publication. All static analysis findings are false positives. The external_commands detections are Java code examples in markdown format, not shell execution. URL references are environment variable documentation examples, not hardcoded endpoints. The cryptographic and system reconnaissance flags are incorrect pattern matches on documentation text and getter method names.
质量评分
你能构建什么
애플리케이션 상태 스토리지
빠른 파티션 기반 조회로 사용자 세션, 애플리케이션 설정 또는 기능 플래그 저장
IoT 텔레메트리 데이터
장치 ID 를 파티션 키로, 타임스탬프를 행 키로 사용하여 센서 데이터 수집 및 쿼리
제품 카탈로그 관리
카테고리 기반 파티션과 효율적인 가격/가용성 쿼리를 통해 제품 재고 유지
试试这些提示
연결 문자열 인증을 사용하여 TableServiceClient 를 생성한 다음, 'inventory' 라는 테이블이 존재하지 않는 경우 생성하세요.
파티션 키 'products', 행 키 'laptop-001', 속성 Name, Price 및 Quantity 를 가진 새 엔티티를 생성하는 방법을 보여주세요. 그런 다음 검색하고 가격을 업데이트하세요.
PartitionKey 가 'electronics' 와 같고 Price 가 100 보다 큰 모든 엔티티를 쿼리하여 Name 과 Price 속성만 반환하고 결과를 10 개로 제한하세요.
동일한 파티션 키 'batch' 와 행 키 'row1', 'row2', 'row3' 을 가진 세 개의 엔티티를 원자적으로 삽입하는 배치 트랜잭션을 생성하세요.
最佳实践
- 쿼리가 고르게 분산되고 핫스팟이 발생하지 않도록 파티션 키 설계
- 최적의 성능을 위해 쿼리에서 항상 PartitionKey 로 필터링
- 동일한 파티션 키를 공유하는 엔티티에 대한 원자적 업데이트를 위해 배치 트랜잭션 사용
避免
- 파티션 키로 타임스탬프 또는 순차 값 사용 시 부하 분산 불균형 발생
- PartitionKey 필터 없이 쿼리하면 전체 테이블 스캔으로 인해 성능 저하
- 엔티티가 크기 제한을 초과하면 실패 발생 - Storage 는 1MB 미만, Cosmos 는 2MB 미만으로 유지