Amazon Timestream for LiveAnalytics와 유사한 기능을 사용하려면 Amazon Timestream for InfluxDB를 고려하세요. 실시간 분석을 위해 간소화된 데이터 수집 및 한 자릿수 밀리초 쿼리 응답 시간을 제공합니다. 여기에서 자세히 알아보세요.
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
파티셔닝 스키마 구성 확인
스키마 파티셔닝을 위한 테이블 구성은 몇 가지 방법으로 확인할 수 있습니다. 콘솔에서 데이터베이스를 선택하고 확인할 테이블을 선택합니다. SDK를 사용하여 DescribeTable
작업에 액세스할 수도 있습니다.
파티션 키가 있는 테이블 설명
다음 코드 조각을 사용하여 파티션 키가 있는 테이블을 설명할 수 있습니다.
- Java
-
public void describeTable() { System.out.println("Describing table"); final DescribeTableRequest describeTableRequest = new DescribeTableRequest(); describeTableRequest.setDatabaseName(DATABASE_NAME); describeTableRequest.setTableName(TABLE_NAME); try { DescribeTableResult result = amazonTimestreamWrite.describeTable(describeTableRequest); String tableId = result.getTable().getArn(); System.out.println("Table " + TABLE_NAME + " has id " + tableId); // If table is created with composite partition key, it can be described with // System.out.println(result.getTable().getSchema().getCompositePartitionKey()); } catch (final Exception e) { System.out.println("Table " + TABLE_NAME + " doesn't exist = " + e); throw e; } }
다음은 예시 출력입니다.
-
테이블에 차원 유형 파티션 키 있음
[{Type: DIMENSION,Name: hostId,EnforcementInRecord: OPTIONAL}]
-
테이블에 측정 이름 유형 파티션 키 있음
[{Type: MEASURE,}]
-
복합 파티션 키를 지정하지 않고 생성된 테이블에서 복합 파티션 키 가져오기
[{Type: MEASURE,}]
-
- Java v2
-
public void describeTable() { System.out.println("Describing table"); final DescribeTableRequest describeTableRequest = DescribeTableRequest.builder() .databaseName(DATABASE_NAME).tableName(TABLE_NAME).build(); try { DescribeTableResponse response = writeClient.describeTable(describeTableRequest); String tableId = response.table().arn(); System.out.println("Table " + TABLE_NAME + " has id " + tableId); // If table is created with composite partition key, it can be described with // System.out.println(response.table().schema().compositePartitionKey()); } catch (final Exception e) { System.out.println("Table " + TABLE_NAME + " doesn't exist = " + e); throw e; } }
다음은 예시 출력입니다.
-
테이블에 차원 유형 파티션 키 있음
[PartitionKey(Type=DIMENSION, Name=hostId, EnforcementInRecord=OPTIONAL)]
-
테이블에 측정 이름 유형 파티션 키 있음
[PartitionKey(Type=MEASURE)]
-
복합 파티션 키를 지정하지 않고 생성된 테이블에서 복합 파티션 키를 가져오면가 반환됩니다.
[PartitionKey(Type=MEASURE)]
-
- Go v1
-
<tablistentry> <tabname> Go </tabname> <tabcontent> <programlisting language="go"></programlisting> </tabcontent> </tablistentry>
다음은 예제 출력입니다.
{ Table: { Arn: "arn:aws:timestream:us-west-2:533139590831:database/devops/table/host_metrics_dim_pk_1", CreationTime: 2023-05-31 01:52:00.511 +0000 UTC, DatabaseName: "devops", LastUpdatedTime: 2023-05-31 01:52:00.511 +0000 UTC, MagneticStoreWriteProperties: { EnableMagneticStoreWrites: true, MagneticStoreRejectedDataLocation: { S3Configuration: { BucketName: "timestream-sample-bucket-west", EncryptionOption: "SSE_S3", ObjectKeyPrefix: "TimeStreamCustomerSampleGo" } } }, RetentionProperties: { MagneticStoreRetentionPeriodInDays: 73000, MemoryStoreRetentionPeriodInHours: 6 }, Schema: { CompositePartitionKey: [{ EnforcementInRecord: "OPTIONAL", Name: "hostId", Type: "DIMENSION" }] }, TableName: "host_metrics_dim_pk_1", TableStatus: "ACTIVE" } }
- Go v2
-
func (timestreamBuilder TimestreamBuilder) DescribeTable() (*timestreamwrite.DescribeTableOutput, error) { describeTableInput := ×treamwrite.DescribeTableInput{ DatabaseName: aws.String(databaseName), TableName: aws.String(tableName), } describeTableOutput, err := timestreamBuilder.WriteSvc.DescribeTable(context.TODO(), describeTableInput) if err != nil { fmt.Printf("Failed to describe table with Error: %s", err.Error()) } else { fmt.Printf("Describe table is successful : %s\n", JsonMarshalIgnoreError(*describeTableOutput)) // If table is created with composite partition key, it will be included in the output } return describeTableOutput, err }
다음은 예제 출력입니다.
{ "Table": { "Arn":"arn:aws:timestream:us-east-1:351861611069:database/cdpk-wr-db/table/host_metrics_dim_pk", "CreationTime":"2023-05-31T22:36:10.66Z", "DatabaseName":"cdpk-wr-db", "LastUpdatedTime":"2023-05-31T22:36:10.66Z", "MagneticStoreWriteProperties":{ "EnableMagneticStoreWrites":true, "MagneticStoreRejectedDataLocation":{ "S3Configuration":{ "BucketName":"error-configuration-sample-s3-bucket-cq8my", "EncryptionOption":"SSE_S3", "KmsKeyId":null,"ObjectKeyPrefix":null } } }, "RetentionProperties":{ "MagneticStoreRetentionPeriodInDays":73000, "MemoryStoreRetentionPeriodInHours":6 }, "Schema":{ "CompositePartitionKey":[{ "Type":"DIMENSION", "EnforcementInRecord":"OPTIONAL", "Name":"hostId" }] }, "TableName":"host_metrics_dim_pk", "TableStatus":"ACTIVE" }, "ResultMetadata":{} }
- Python
-
def describe_table(self): print('Describing table') try: result = self.client.describe_table(DatabaseName=DATABASE_NAME, TableName=TABLE_NAME) print("Table [%s] has id [%s]" % (TABLE_NAME, result['Table']['Arn'])) # If table is created with composite partition key, it can be described with # print(result['Table']['Schema']) except self.client.exceptions.ResourceNotFoundException: print("Table doesn't exist") except Exception as err: print("Describe table failed:", err)
다음은 예시 출력입니다.
-
테이블에 차원 유형 파티션 키 있음
[{'CompositePartitionKey': [{'Type': 'DIMENSION', 'Name': 'hostId', 'EnforcementInRecord': 'OPTIONAL'}]}]
-
테이블에 측정 이름 유형 파티션 키 있음
[{'CompositePartitionKey': [{'Type': 'MEASURE'}]}]
-
복합 파티션 키를 지정하지 않고 생성된 테이블에서 복합 파티션 키 가져오기
[{'CompositePartitionKey': [{'Type': 'MEASURE'}]}]
-
고객 정의 파티션 키 시작하기
파티셔닝 스키마 구성 업데이트