Skip to content

Commit

Permalink
feat(client-timestream-write): This release adds the capability for c…
Browse files Browse the repository at this point in the history
…ustomers to define how their data should be partitioned, optimizing for certain access patterns. This definition will take place as a part of the table creation.
  • Loading branch information
awstools committed Jun 8, 2023
1 parent 655c2dd commit bba2033
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export interface CreateBatchLoadTaskCommandOutput extends CreateBatchLoadTaskRes
* a CSV source in an S3 location and writes to a Timestream table. A mapping from
* source to target is defined in a batch load task. Errors and events are written to a report
* at an S3 location. For the report, if the KMS key is not specified, the
* batch load task will be encrypted with a Timestream managed KMS key
* located in your account. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed
* report will be encrypted with an S3 managed key when <code>SSE_S3</code> is the option.
* Otherwise an error is thrown. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed
* keys</a>. <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html">Service quotas apply</a>. For
* details, see <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.create-batch-load.html">code
* sample</a>.</p>
Expand Down
18 changes: 18 additions & 0 deletions clients/client-timestream-write/src/commands/CreateTableCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ export interface CreateTableCommandOutput extends CreateTableResponse, __Metadat
* },
* },
* },
* Schema: { // Schema
* CompositePartitionKey: [ // PartitionKeyList
* { // PartitionKey
* Type: "DIMENSION" || "MEASURE", // required
* Name: "STRING_VALUE",
* EnforcementInRecord: "REQUIRED" || "OPTIONAL",
* },
* ],
* },
* };
* const command = new CreateTableCommand(input);
* const response = await client.send(command);
Expand All @@ -99,6 +108,15 @@ export interface CreateTableCommandOutput extends CreateTableResponse, __Metadat
* // },
* // },
* // },
* // Schema: { // Schema
* // CompositePartitionKey: [ // PartitionKeyList
* // { // PartitionKey
* // Type: "DIMENSION" || "MEASURE", // required
* // Name: "STRING_VALUE",
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
* // },
* // ],
* // },
* // },
* // };
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ export interface DescribeTableCommandOutput extends DescribeTableResponse, __Met
* // },
* // },
* // },
* // Schema: { // Schema
* // CompositePartitionKey: [ // PartitionKeyList
* // { // PartitionKey
* // Type: "DIMENSION" || "MEASURE", // required
* // Name: "STRING_VALUE",
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
* // },
* // ],
* // },
* // },
* // };
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ export interface ListTablesCommandOutput extends ListTablesResponse, __MetadataB
* // },
* // },
* // },
* // Schema: { // Schema
* // CompositePartitionKey: [ // PartitionKeyList
* // { // PartitionKey
* // Type: "DIMENSION" || "MEASURE", // required
* // Name: "STRING_VALUE",
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
* // },
* // ],
* // },
* // },
* // ],
* // NextToken: "STRING_VALUE",
Expand Down
18 changes: 18 additions & 0 deletions clients/client-timestream-write/src/commands/UpdateTableCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ export interface UpdateTableCommandOutput extends UpdateTableResponse, __Metadat
* },
* },
* },
* Schema: { // Schema
* CompositePartitionKey: [ // PartitionKeyList
* { // PartitionKey
* Type: "DIMENSION" || "MEASURE", // required
* Name: "STRING_VALUE",
* EnforcementInRecord: "REQUIRED" || "OPTIONAL",
* },
* ],
* },
* };
* const command = new UpdateTableCommand(input);
* const response = await client.send(command);
Expand All @@ -93,6 +102,15 @@ export interface UpdateTableCommandOutput extends UpdateTableResponse, __Metadat
* // },
* // },
* // },
* // Schema: { // Schema
* // CompositePartitionKey: [ // PartitionKeyList
* // { // PartitionKey
* // Type: "DIMENSION" || "MEASURE", // required
* // Name: "STRING_VALUE",
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
* // },
* // ],
* // },
* // },
* // };
*
Expand Down
103 changes: 97 additions & 6 deletions clients/client-timestream-write/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,8 @@ export interface ReportS3Configuration {

/**
* @public
* <p>Report configuration for a batch load task. This contains details about where error reports are stored.</p>
* <p>Report configuration for a batch load task. This contains details about where error
* reports are stored.</p>
*/
export interface ReportConfiguration {
/**
Expand Down Expand Up @@ -491,12 +492,14 @@ export interface BatchLoadTaskDescription {
ProgressReport?: BatchLoadProgressReport;

/**
* <p>Report configuration for a batch load task. This contains details about where error reports are stored.</p>
* <p>Report configuration for a batch load task. This contains details about where error
* reports are stored.</p>
*/
ReportConfiguration?: ReportConfiguration;

/**
* <p>Data model configuration for a batch load task. This contains details about where a data model for a batch load task is stored.</p>
* <p>Data model configuration for a batch load task. This contains details about where a data
* model for a batch load task is stored.</p>
*/
DataModelConfiguration?: DataModelConfiguration;

Expand Down Expand Up @@ -580,7 +583,8 @@ export interface CreateBatchLoadTaskRequest {
DataSourceConfiguration: DataSourceConfiguration | undefined;

/**
* <p>Report configuration for a batch load task. This contains details about where error reports are stored.</p>
* <p>Report configuration for a batch load task. This contains details about where error
* reports are stored.</p>
*/
ReportConfiguration: ReportConfiguration | undefined;

Expand Down Expand Up @@ -909,6 +913,76 @@ export interface RetentionProperties {
MagneticStoreRetentionPeriodInDays: number | undefined;
}

/**
* @public
* @enum
*/
export const PartitionKeyEnforcementLevel = {
OPTIONAL: "OPTIONAL",
REQUIRED: "REQUIRED",
} as const;

/**
* @public
*/
export type PartitionKeyEnforcementLevel =
(typeof PartitionKeyEnforcementLevel)[keyof typeof PartitionKeyEnforcementLevel];

/**
* @public
* @enum
*/
export const PartitionKeyType = {
DIMENSION: "DIMENSION",
MEASURE: "MEASURE",
} as const;

/**
* @public
*/
export type PartitionKeyType = (typeof PartitionKeyType)[keyof typeof PartitionKeyType];

/**
* @public
* <p> An attribute used in partitioning data in a table. A dimension key partitions data
* using the values of the dimension specified by the dimension-name as partition key, while a
* measure key partitions data using measure names (values of the 'measure_name' column).
* </p>
*/
export interface PartitionKey {
/**
* <p> The type of the partition key. Options are DIMENSION (dimension key) and MEASURE
* (measure key). </p>
*/
Type: PartitionKeyType | string | undefined;

/**
* <p> The name of the attribute used for a dimension key. </p>
*/
Name?: string;

/**
* <p> The level of enforcement for the specification of a dimension key in ingested records.
* Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not
* have to be specified). </p>
*/
EnforcementInRecord?: PartitionKeyEnforcementLevel | string;
}

/**
* @public
* <p> A Schema specifies the expected data model of the table. </p>
*/
export interface Schema {
/**
* <p>A non-empty list of partition keys defining the attributes used to partition the table
* data. The order of the list determines the partition hierarchy. The name and type of each
* partition key as well as the partition key order cannot be changed after the table is
* created. However, the enforcement level of each partition key can be changed. </p>
*/
CompositePartitionKey?: PartitionKey[];
}

/**
* @public
*/
Expand Down Expand Up @@ -938,6 +1012,11 @@ export interface CreateTableRequest {
* <p>Contains properties to set on the table when enabling magnetic store writes.</p>
*/
MagneticStoreWriteProperties?: MagneticStoreWriteProperties;

/**
* <p> The schema of the table. </p>
*/
Schema?: Schema;
}

/**
Expand Down Expand Up @@ -1011,6 +1090,11 @@ export interface Table {
* <p>Contains properties to set on the table when enabling magnetic store writes.</p>
*/
MagneticStoreWriteProperties?: MagneticStoreWriteProperties;

/**
* <p> The schema of the table. </p>
*/
Schema?: Schema;
}

/**
Expand Down Expand Up @@ -1338,7 +1422,8 @@ export interface MeasureValue {
Name: string | undefined;

/**
* <p> The value for the MeasureValue. </p>
* <p> The value for the MeasureValue. For information, see <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/writes.html#writes.data-types">Data
* types</a>.</p>
*/
Value: string | undefined;

Expand Down Expand Up @@ -1384,7 +1469,8 @@ export interface _Record {

/**
* <p> Contains the data type of the measure value for the time-series data point. Default
* type is <code>DOUBLE</code>. </p>
* type is <code>DOUBLE</code>. For more information, see <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/writes.html#writes.data-types">Data
* types</a>.</p>
*/
MeasureValueType?: MeasureValueType | string;

Expand Down Expand Up @@ -1699,6 +1785,11 @@ export interface UpdateTableRequest {
* <p>Contains properties to set on the table when enabling magnetic store writes.</p>
*/
MagneticStoreWriteProperties?: MagneticStoreWriteProperties;

/**
* <p> The schema of the table. </p>
*/
Schema?: Schema;
}

/**
Expand Down
15 changes: 15 additions & 0 deletions clients/client-timestream-write/src/protocols/Aws_json1_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ import {
MixedMeasureMapping,
MultiMeasureAttributeMapping,
MultiMeasureMappings,
PartitionKey,
RejectedRecordsException,
ReportConfiguration,
ReportS3Configuration,
ResourceNotFoundException,
ResumeBatchLoadTaskRequest,
RetentionProperties,
S3Configuration,
Schema,
ServiceQuotaExceededException,
Table,
Tag,
Expand Down Expand Up @@ -1715,6 +1717,10 @@ const se_CreateBatchLoadTaskRequest = (input: CreateBatchLoadTaskRequest, contex

// se_MultiMeasureMappings omitted.

// se_PartitionKey omitted.

// se_PartitionKeyList omitted.

// se__Record omitted.

// se_Records omitted.
Expand All @@ -1729,6 +1735,8 @@ const se_CreateBatchLoadTaskRequest = (input: CreateBatchLoadTaskRequest, contex

// se_S3Configuration omitted.

// se_Schema omitted.

// se_Tag omitted.

// se_TagKeyList omitted.
Expand Down Expand Up @@ -1944,6 +1952,10 @@ const de_ListTablesResponse = (output: any, context: __SerdeContext): ListTables

// de_MultiMeasureMappings omitted.

// de_PartitionKey omitted.

// de_PartitionKeyList omitted.

// de_RecordsIngested omitted.

// de_RejectedRecord omitted.
Expand All @@ -1964,6 +1976,8 @@ const de_ListTablesResponse = (output: any, context: __SerdeContext): ListTables

// de_S3Configuration omitted.

// de_Schema omitted.

// de_ServiceQuotaExceededException omitted.

/**
Expand All @@ -1977,6 +1991,7 @@ const de_Table = (output: any, context: __SerdeContext): Table => {
LastUpdatedTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
MagneticStoreWriteProperties: _json,
RetentionProperties: _json,
Schema: _json,
TableName: __expectString,
TableStatus: __expectString,
}) as any;
Expand Down
Loading

0 comments on commit bba2033

Please sign in to comment.