Amazon Timestream for LiveAnalytics와 유사한 기능을 원하는 경우 Amazon Timestream for InfluxDB를 고려해 보세요. 간소화된 데이터 수집과 실시간 분석을 위한 10밀리초 미만의 쿼리 응답 시간을 제공합니다. 여기에서 자세히 알아보세요.
파티셔닝 스키마 구성 업데이트
UpdateTable 작업에 액세스할 수 있는 SDK를 사용하여 파티셔닝 스키마에 대한 테이블 구성을 업데이트할 수 있습니다.
파티션 키가 있는 테이블 업데이트
다음 코드 조각을 사용하여 파티션 키가 있는 테이블을 업데이트할 수 있습니다.
- Java
-
public void updateTableCompositePartitionKeyEnforcement() { System.out.println("Updating table"); UpdateTableRequest updateTableRequest = new UpdateTableRequest(); updateTableRequest.setDatabaseName(DATABASE_NAME); updateTableRequest.setTableName(TABLE_NAME); // Can update enforcement level for dimension type partition key with OPTIONAL or REQUIRED enforcement final List<PartitionKey> partitionKeyWithDimensionAndRequiredEnforcement = Collections.singletonList(new PartitionKey() .withName(COMPOSITE_PARTITION_KEY_DIM_NAME) .withType(PartitionKeyType.DIMENSION) .withEnforcementInRecord(PartitionKeyEnforcementLevel.REQUIRED)); Schema schema = new Schema(); schema.setCompositePartitionKey(partitionKeyWithDimensionAndRequiredEnforcement); updateTableRequest.withSchema(schema); writeClient.updateTable(updateTableRequest); System.out.println("Table updated"); - Java v2
-
public void updateTableCompositePartitionKeyEnforcement() { System.out.println("Updating table"); // Can update enforcement level for dimension type partition key with OPTIONAL or REQUIRED enforcement final List<PartitionKey> partitionKeyWithDimensionAndRequiredEnforcement = Collections.singletonList(PartitionKey .builder() .name(COMPOSITE_PARTITION_KEY_DIM_NAME) .type(PartitionKeyType.DIMENSION) .enforcementInRecord(PartitionKeyEnforcementLevel.REQUIRED) .build()); final Schema schema = Schema.builder() .compositePartitionKey(partitionKeyWithDimensionAndRequiredEnforcement).build(); final UpdateTableRequest updateTableRequest = UpdateTableRequest.builder() .databaseName(DATABASE_NAME).tableName(TABLE_NAME).schema(schema).build(); writeClient.updateTable(updateTableRequest); System.out.println("Table updated"); - Go v1
-
// Update table partition key enforcement attribute updateTableInput := ×treamwrite.UpdateTableInput{ DatabaseName: aws.String(*databaseName), TableName: aws.String(*tableName), // Can update enforcement level for dimension type partition key with OPTIONAL or REQUIRED enforcement Schema: ×treamwrite.Schema{ CompositePartitionKey: []*timestreamwrite.PartitionKey{ { Name: aws.String(CompositePartitionKeyDimName), EnforcementInRecord: aws.String("REQUIRED"), Type: aws.String("DIMENSION"), }, }}, } updateTableOutput, err := writeSvc.UpdateTable(updateTableInput) if err != nil { fmt.Println("Error:") fmt.Println(err) } else { fmt.Println("Update table is successful, below is the output:") fmt.Println(updateTableOutput) } - Go v2
-
// Update table partition key enforcement attribute updateTableInput := ×treamwrite.UpdateTableInput{ DatabaseName: aws.String(*databaseName), TableName: aws.String(*tableName), // Can update enforcement level for dimension type partition key with OPTIONAL or REQUIRED enforcement Schema: &types.Schema{ CompositePartitionKey: []types.PartitionKey{ { Name: aws.String(CompositePartitionKeyDimName), EnforcementInRecord: types.PartitionKeyEnforcementLevelRequired, Type: types.PartitionKeyTypeDimension, }, }}, } updateTableOutput, err := timestreamBuilder.WriteSvc.UpdateTable(context.TODO(), updateTableInput) if err != nil { fmt.Println("Error:") fmt.Println(err) } else { fmt.Println("Update table is successful, below is the output:") fmt.Println(updateTableOutput) } - Python
-
def update_table(self): print('Updating table') try: # Can update enforcement level for dimension type partition key with OPTIONAL or REQUIRED enforcement partition_key_with_dimension_and_required_enforcement = [ { 'Type': 'DIMENSION', 'Name': COMPOSITE_PARTITION_KEY_DIM_NAME, 'EnforcementInRecord': 'REQUIRED' } ] schema = { 'CompositePartitionKey': partition_key_with_dimension_and_required_enforcement } self.client.update_table(DatabaseName=DATABASE_NAME, TableName=TABLE_NAME, Schema=schema) print('Table updated.') except Exception as err: print('Update table failed:', err)
파티셔닝 스키마 구성 확인
고객 정의 파티션 키의 장점