Skip to content

Commit bba2033

Browse files
author
awstools
committed
feat(client-timestream-write): This release adds the capability for customers 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.
1 parent 655c2dd commit bba2033

File tree

8 files changed

+367
-53
lines changed

8 files changed

+367
-53
lines changed

clients/client-timestream-write/src/commands/CreateBatchLoadTaskCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export interface CreateBatchLoadTaskCommandOutput extends CreateBatchLoadTaskRes
4545
* a CSV source in an S3 location and writes to a Timestream table. A mapping from
4646
* source to target is defined in a batch load task. Errors and events are written to a report
4747
* at an S3 location. For the report, if the KMS key is not specified, the
48-
* batch load task will be encrypted with a Timestream managed KMS key
49-
* 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
48+
* report will be encrypted with an S3 managed key when <code>SSE_S3</code> is the option.
49+
* 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
5050
* keys</a>. <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html">Service quotas apply</a>. For
5151
* details, see <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.create-batch-load.html">code
5252
* sample</a>.</p>

clients/client-timestream-write/src/commands/CreateTableCommand.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ export interface CreateTableCommandOutput extends CreateTableResponse, __Metadat
7373
* },
7474
* },
7575
* },
76+
* Schema: { // Schema
77+
* CompositePartitionKey: [ // PartitionKeyList
78+
* { // PartitionKey
79+
* Type: "DIMENSION" || "MEASURE", // required
80+
* Name: "STRING_VALUE",
81+
* EnforcementInRecord: "REQUIRED" || "OPTIONAL",
82+
* },
83+
* ],
84+
* },
7685
* };
7786
* const command = new CreateTableCommand(input);
7887
* const response = await client.send(command);
@@ -99,6 +108,15 @@ export interface CreateTableCommandOutput extends CreateTableResponse, __Metadat
99108
* // },
100109
* // },
101110
* // },
111+
* // Schema: { // Schema
112+
* // CompositePartitionKey: [ // PartitionKeyList
113+
* // { // PartitionKey
114+
* // Type: "DIMENSION" || "MEASURE", // required
115+
* // Name: "STRING_VALUE",
116+
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
117+
* // },
118+
* // ],
119+
* // },
102120
* // },
103121
* // };
104122
*

clients/client-timestream-write/src/commands/DescribeTableCommand.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ export interface DescribeTableCommandOutput extends DescribeTableResponse, __Met
7676
* // },
7777
* // },
7878
* // },
79+
* // Schema: { // Schema
80+
* // CompositePartitionKey: [ // PartitionKeyList
81+
* // { // PartitionKey
82+
* // Type: "DIMENSION" || "MEASURE", // required
83+
* // Name: "STRING_VALUE",
84+
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
85+
* // },
86+
* // ],
87+
* // },
7988
* // },
8089
* // };
8190
*

clients/client-timestream-write/src/commands/ListTablesCommand.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ export interface ListTablesCommandOutput extends ListTablesResponse, __MetadataB
7777
* // },
7878
* // },
7979
* // },
80+
* // Schema: { // Schema
81+
* // CompositePartitionKey: [ // PartitionKeyList
82+
* // { // PartitionKey
83+
* // Type: "DIMENSION" || "MEASURE", // required
84+
* // Name: "STRING_VALUE",
85+
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
86+
* // },
87+
* // ],
88+
* // },
8089
* // },
8190
* // ],
8291
* // NextToken: "STRING_VALUE",

clients/client-timestream-write/src/commands/UpdateTableCommand.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ export interface UpdateTableCommandOutput extends UpdateTableResponse, __Metadat
6767
* },
6868
* },
6969
* },
70+
* Schema: { // Schema
71+
* CompositePartitionKey: [ // PartitionKeyList
72+
* { // PartitionKey
73+
* Type: "DIMENSION" || "MEASURE", // required
74+
* Name: "STRING_VALUE",
75+
* EnforcementInRecord: "REQUIRED" || "OPTIONAL",
76+
* },
77+
* ],
78+
* },
7079
* };
7180
* const command = new UpdateTableCommand(input);
7281
* const response = await client.send(command);
@@ -93,6 +102,15 @@ export interface UpdateTableCommandOutput extends UpdateTableResponse, __Metadat
93102
* // },
94103
* // },
95104
* // },
105+
* // Schema: { // Schema
106+
* // CompositePartitionKey: [ // PartitionKeyList
107+
* // { // PartitionKey
108+
* // Type: "DIMENSION" || "MEASURE", // required
109+
* // Name: "STRING_VALUE",
110+
* // EnforcementInRecord: "REQUIRED" || "OPTIONAL",
111+
* // },
112+
* // ],
113+
* // },
96114
* // },
97115
* // };
98116
*

clients/client-timestream-write/src/models/models_0.ts

Lines changed: 97 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ export interface ReportS3Configuration {
455455

456456
/**
457457
* @public
458-
* <p>Report configuration for a batch load task. This contains details about where error reports are stored.</p>
458+
* <p>Report configuration for a batch load task. This contains details about where error
459+
* reports are stored.</p>
459460
*/
460461
export interface ReportConfiguration {
461462
/**
@@ -491,12 +492,14 @@ export interface BatchLoadTaskDescription {
491492
ProgressReport?: BatchLoadProgressReport;
492493

493494
/**
494-
* <p>Report configuration for a batch load task. This contains details about where error reports are stored.</p>
495+
* <p>Report configuration for a batch load task. This contains details about where error
496+
* reports are stored.</p>
495497
*/
496498
ReportConfiguration?: ReportConfiguration;
497499

498500
/**
499-
* <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>
501+
* <p>Data model configuration for a batch load task. This contains details about where a data
502+
* model for a batch load task is stored.</p>
500503
*/
501504
DataModelConfiguration?: DataModelConfiguration;
502505

@@ -580,7 +583,8 @@ export interface CreateBatchLoadTaskRequest {
580583
DataSourceConfiguration: DataSourceConfiguration | undefined;
581584

582585
/**
583-
* <p>Report configuration for a batch load task. This contains details about where error reports are stored.</p>
586+
* <p>Report configuration for a batch load task. This contains details about where error
587+
* reports are stored.</p>
584588
*/
585589
ReportConfiguration: ReportConfiguration | undefined;
586590

@@ -909,6 +913,76 @@ export interface RetentionProperties {
909913
MagneticStoreRetentionPeriodInDays: number | undefined;
910914
}
911915

916+
/**
917+
* @public
918+
* @enum
919+
*/
920+
export const PartitionKeyEnforcementLevel = {
921+
OPTIONAL: "OPTIONAL",
922+
REQUIRED: "REQUIRED",
923+
} as const;
924+
925+
/**
926+
* @public
927+
*/
928+
export type PartitionKeyEnforcementLevel =
929+
(typeof PartitionKeyEnforcementLevel)[keyof typeof PartitionKeyEnforcementLevel];
930+
931+
/**
932+
* @public
933+
* @enum
934+
*/
935+
export const PartitionKeyType = {
936+
DIMENSION: "DIMENSION",
937+
MEASURE: "MEASURE",
938+
} as const;
939+
940+
/**
941+
* @public
942+
*/
943+
export type PartitionKeyType = (typeof PartitionKeyType)[keyof typeof PartitionKeyType];
944+
945+
/**
946+
* @public
947+
* <p> An attribute used in partitioning data in a table. A dimension key partitions data
948+
* using the values of the dimension specified by the dimension-name as partition key, while a
949+
* measure key partitions data using measure names (values of the 'measure_name' column).
950+
* </p>
951+
*/
952+
export interface PartitionKey {
953+
/**
954+
* <p> The type of the partition key. Options are DIMENSION (dimension key) and MEASURE
955+
* (measure key). </p>
956+
*/
957+
Type: PartitionKeyType | string | undefined;
958+
959+
/**
960+
* <p> The name of the attribute used for a dimension key. </p>
961+
*/
962+
Name?: string;
963+
964+
/**
965+
* <p> The level of enforcement for the specification of a dimension key in ingested records.
966+
* Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not
967+
* have to be specified). </p>
968+
*/
969+
EnforcementInRecord?: PartitionKeyEnforcementLevel | string;
970+
}
971+
972+
/**
973+
* @public
974+
* <p> A Schema specifies the expected data model of the table. </p>
975+
*/
976+
export interface Schema {
977+
/**
978+
* <p>A non-empty list of partition keys defining the attributes used to partition the table
979+
* data. The order of the list determines the partition hierarchy. The name and type of each
980+
* partition key as well as the partition key order cannot be changed after the table is
981+
* created. However, the enforcement level of each partition key can be changed. </p>
982+
*/
983+
CompositePartitionKey?: PartitionKey[];
984+
}
985+
912986
/**
913987
* @public
914988
*/
@@ -938,6 +1012,11 @@ export interface CreateTableRequest {
9381012
* <p>Contains properties to set on the table when enabling magnetic store writes.</p>
9391013
*/
9401014
MagneticStoreWriteProperties?: MagneticStoreWriteProperties;
1015+
1016+
/**
1017+
* <p> The schema of the table. </p>
1018+
*/
1019+
Schema?: Schema;
9411020
}
9421021

9431022
/**
@@ -1011,6 +1090,11 @@ export interface Table {
10111090
* <p>Contains properties to set on the table when enabling magnetic store writes.</p>
10121091
*/
10131092
MagneticStoreWriteProperties?: MagneticStoreWriteProperties;
1093+
1094+
/**
1095+
* <p> The schema of the table. </p>
1096+
*/
1097+
Schema?: Schema;
10141098
}
10151099

10161100
/**
@@ -1338,7 +1422,8 @@ export interface MeasureValue {
13381422
Name: string | undefined;
13391423

13401424
/**
1341-
* <p> The value for the MeasureValue. </p>
1425+
* <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
1426+
* types</a>.</p>
13421427
*/
13431428
Value: string | undefined;
13441429

@@ -1384,7 +1469,8 @@ export interface _Record {
13841469

13851470
/**
13861471
* <p> Contains the data type of the measure value for the time-series data point. Default
1387-
* type is <code>DOUBLE</code>. </p>
1472+
* 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
1473+
* types</a>.</p>
13881474
*/
13891475
MeasureValueType?: MeasureValueType | string;
13901476

@@ -1699,6 +1785,11 @@ export interface UpdateTableRequest {
16991785
* <p>Contains properties to set on the table when enabling magnetic store writes.</p>
17001786
*/
17011787
MagneticStoreWriteProperties?: MagneticStoreWriteProperties;
1788+
1789+
/**
1790+
* <p> The schema of the table. </p>
1791+
*/
1792+
Schema?: Schema;
17021793
}
17031794

17041795
/**

clients/client-timestream-write/src/protocols/Aws_json1_0.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,15 @@ import {
9090
MixedMeasureMapping,
9191
MultiMeasureAttributeMapping,
9292
MultiMeasureMappings,
93+
PartitionKey,
9394
RejectedRecordsException,
9495
ReportConfiguration,
9596
ReportS3Configuration,
9697
ResourceNotFoundException,
9798
ResumeBatchLoadTaskRequest,
9899
RetentionProperties,
99100
S3Configuration,
101+
Schema,
100102
ServiceQuotaExceededException,
101103
Table,
102104
Tag,
@@ -1715,6 +1717,10 @@ const se_CreateBatchLoadTaskRequest = (input: CreateBatchLoadTaskRequest, contex
17151717

17161718
// se_MultiMeasureMappings omitted.
17171719

1720+
// se_PartitionKey omitted.
1721+
1722+
// se_PartitionKeyList omitted.
1723+
17181724
// se__Record omitted.
17191725

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

17301736
// se_S3Configuration omitted.
17311737

1738+
// se_Schema omitted.
1739+
17321740
// se_Tag omitted.
17331741

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

19451953
// de_MultiMeasureMappings omitted.
19461954

1955+
// de_PartitionKey omitted.
1956+
1957+
// de_PartitionKeyList omitted.
1958+
19471959
// de_RecordsIngested omitted.
19481960

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

19651977
// de_S3Configuration omitted.
19661978

1979+
// de_Schema omitted.
1980+
19671981
// de_ServiceQuotaExceededException omitted.
19681982

19691983
/**
@@ -1977,6 +1991,7 @@ const de_Table = (output: any, context: __SerdeContext): Table => {
19771991
LastUpdatedTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
19781992
MagneticStoreWriteProperties: _json,
19791993
RetentionProperties: _json,
1994+
Schema: _json,
19801995
TableName: __expectString,
19811996
TableStatus: __expectString,
19821997
}) as any;

0 commit comments

Comments
 (0)