diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 9595152..04012b7 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -115,9 +115,11 @@ docs/SecretMetadataResponse.md docs/SecretsApi.md docs/SubmitJobResponse.md docs/TableInfo.md +docs/TablePartitionKey.md docs/TableProfileResponse.md docs/TableRefreshError.md docs/TableRefreshResult.md +docs/TableSortKey.md docs/TemporalProfileDetail.md docs/TextProfileDetail.md docs/UpdateEmbeddingProviderRequest.md @@ -256,9 +258,11 @@ src/models/schema_refresh_result.rs src/models/secret_metadata_response.rs src/models/submit_job_response.rs src/models/table_info.rs +src/models/table_partition_key.rs src/models/table_profile_response.rs src/models/table_refresh_error.rs src/models/table_refresh_result.rs +src/models/table_sort_key.rs src/models/temporal_profile_detail.rs src/models/text_profile_detail.rs src/models/update_embedding_provider_request.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b4ef26..4bf6a07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- feat(tables): add partition_by and sorted_by configuration - `QueryRunInfo::user_public_id` now reports the caller's stable account id (the access token's subject) instead of a fingerprint of the bearer token, which churned every few minutes as short-lived JWTs were reminted. Grouping a diff --git a/docs/AddManagedTableDecl.md b/docs/AddManagedTableDecl.md index 64572b4..037a6a7 100644 --- a/docs/AddManagedTableDecl.md +++ b/docs/AddManagedTableDecl.md @@ -6,6 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **key** | Option<**Vec**> | Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected. | [optional] **name** | **String** | | +**partition_by** | Option<[**Vec**](TablePartitionKey.md)> | Partition keys for this table, applied in order. Omit for no partitioning. Declared when the table is created and fixed thereafter. | [optional] +**sorted_by** | Option<[**Vec**](TableSortKey.md)> | Sort keys for this table, applied in order. Omit for no sort order. Declared when the table is created and fixed thereafter. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/AddManagedTableRequest.md b/docs/AddManagedTableRequest.md index 94f858c..cb48401 100644 --- a/docs/AddManagedTableRequest.md +++ b/docs/AddManagedTableRequest.md @@ -6,6 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **key** | Option<**Vec**> | Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected. | [optional] **name** | **String** | | +**partition_by** | Option<[**Vec**](TablePartitionKey.md)> | Partition keys for this table, applied in order. Omit for no partitioning. Declared when the table is created and fixed thereafter. | [optional] +**sorted_by** | Option<[**Vec**](TableSortKey.md)> | Sort keys for this table, applied in order. Omit for no sort order. Declared when the table is created and fixed thereafter. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/DatabaseDefaultTableDecl.md b/docs/DatabaseDefaultTableDecl.md index 2d18c3d..20be91f 100644 --- a/docs/DatabaseDefaultTableDecl.md +++ b/docs/DatabaseDefaultTableDecl.md @@ -6,6 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **key** | Option<**Vec**> | Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected. | [optional] **name** | **String** | | +**partition_by** | Option<[**Vec**](TablePartitionKey.md)> | Partition keys for this table, applied in order. Omit for no partitioning. Declared when the table is created and fixed thereafter. | [optional] +**sorted_by** | Option<[**Vec**](TableSortKey.md)> | Sort keys for this table, applied in order. Omit for no sort order. Declared when the table is created and fixed thereafter. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/TablePartitionKey.md b/docs/TablePartitionKey.md new file mode 100644 index 0000000..61e978d --- /dev/null +++ b/docs/TablePartitionKey.md @@ -0,0 +1,12 @@ +# TablePartitionKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**column** | **String** | Column the key reads. | +**transform** | **String** | How the value is derived from the column. One of `identity` (the column value itself), `year`, `month`, `day`, or `hour`. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TableSortKey.md b/docs/TableSortKey.md new file mode 100644 index 0000000..a01366a --- /dev/null +++ b/docs/TableSortKey.md @@ -0,0 +1,13 @@ +# TableSortKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**column** | **String** | | +**direction** | Option<**String**> | `asc` (the default) or `desc`. | [optional] +**nulls** | Option<**String**> | Where nulls are placed: `first` or `last`. Defaults to the SQL default for the chosen direction. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/models/add_managed_table_decl.rs b/src/models/add_managed_table_decl.rs index 80badb1..e1aa127 100644 --- a/src/models/add_managed_table_decl.rs +++ b/src/models/add_managed_table_decl.rs @@ -19,11 +19,22 @@ pub struct AddManagedTableDecl { pub key: Option>, #[serde(rename = "name")] pub name: String, + /// Partition keys for this table, applied in order. Omit for no partitioning. Declared when the table is created and fixed thereafter. + #[serde(rename = "partition_by", skip_serializing_if = "Option::is_none")] + pub partition_by: Option>, + /// Sort keys for this table, applied in order. Omit for no sort order. Declared when the table is created and fixed thereafter. + #[serde(rename = "sorted_by", skip_serializing_if = "Option::is_none")] + pub sorted_by: Option>, } impl AddManagedTableDecl { /// One table declaration inside an add-schema request body. pub fn new(name: String) -> AddManagedTableDecl { - AddManagedTableDecl { key: None, name } + AddManagedTableDecl { + key: None, + name, + partition_by: None, + sorted_by: None, + } } } diff --git a/src/models/add_managed_table_request.rs b/src/models/add_managed_table_request.rs index b11e759..18f37a3 100644 --- a/src/models/add_managed_table_request.rs +++ b/src/models/add_managed_table_request.rs @@ -19,11 +19,22 @@ pub struct AddManagedTableRequest { pub key: Option>, #[serde(rename = "name")] pub name: String, + /// Partition keys for this table, applied in order. Omit for no partitioning. Declared when the table is created and fixed thereafter. + #[serde(rename = "partition_by", skip_serializing_if = "Option::is_none")] + pub partition_by: Option>, + /// Sort keys for this table, applied in order. Omit for no sort order. Declared when the table is created and fixed thereafter. + #[serde(rename = "sorted_by", skip_serializing_if = "Option::is_none")] + pub sorted_by: Option>, } impl AddManagedTableRequest { /// Request body for adding a table to an existing schema: `POST /v1/connections/{id}/schemas/{schema}/tables` and `POST /v1/databases/{id}/schemas/{schema}/tables`. pub fn new(name: String) -> AddManagedTableRequest { - AddManagedTableRequest { key: None, name } + AddManagedTableRequest { + key: None, + name, + partition_by: None, + sorted_by: None, + } } } diff --git a/src/models/database_default_table_decl.rs b/src/models/database_default_table_decl.rs index a677fd5..a2a47b8 100644 --- a/src/models/database_default_table_decl.rs +++ b/src/models/database_default_table_decl.rs @@ -19,11 +19,22 @@ pub struct DatabaseDefaultTableDecl { pub key: Option>, #[serde(rename = "name")] pub name: String, + /// Partition keys for this table, applied in order. Omit for no partitioning. Declared when the table is created and fixed thereafter. + #[serde(rename = "partition_by", skip_serializing_if = "Option::is_none")] + pub partition_by: Option>, + /// Sort keys for this table, applied in order. Omit for no sort order. Declared when the table is created and fixed thereafter. + #[serde(rename = "sorted_by", skip_serializing_if = "Option::is_none")] + pub sorted_by: Option>, } impl DatabaseDefaultTableDecl { /// One table declaration inside a default-catalog schema, supplied at database-create time. pub fn new(name: String) -> DatabaseDefaultTableDecl { - DatabaseDefaultTableDecl { key: None, name } + DatabaseDefaultTableDecl { + key: None, + name, + partition_by: None, + sorted_by: None, + } } } diff --git a/src/models/mod.rs b/src/models/mod.rs index 863a57b..9f1fb51 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -202,12 +202,16 @@ pub mod submit_job_response; pub use self::submit_job_response::SubmitJobResponse; pub mod table_info; pub use self::table_info::TableInfo; +pub mod table_partition_key; +pub use self::table_partition_key::TablePartitionKey; pub mod table_profile_response; pub use self::table_profile_response::TableProfileResponse; pub mod table_refresh_error; pub use self::table_refresh_error::TableRefreshError; pub mod table_refresh_result; pub use self::table_refresh_result::TableRefreshResult; +pub mod table_sort_key; +pub use self::table_sort_key::TableSortKey; pub mod temporal_profile_detail; pub use self::temporal_profile_detail::TemporalProfileDetail; pub mod text_profile_detail; diff --git a/src/models/table_partition_key.rs b/src/models/table_partition_key.rs new file mode 100644 index 0000000..005f193 --- /dev/null +++ b/src/models/table_partition_key.rs @@ -0,0 +1,30 @@ +/* + * Hotdata API + * + * Powerful data platform API for managed databases, queries, and analytics. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: developers@hotdata.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// TablePartitionKey : One partition key of a table's storage layout. Partitioning groups rows that share a key value into their own files, so a query filtering on that key reads only the matching files. Keys are applied in the order given, and several keys may read the same column: to get one partition per calendar month, declare `year` and `month` on the timestamp column. A single calendar transform on its own is rarely what you want — `month` alone puts every March of every year in one partition. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TablePartitionKey { + /// Column the key reads. + #[serde(rename = "column")] + pub column: String, + /// How the value is derived from the column. One of `identity` (the column value itself), `year`, `month`, `day`, or `hour`. + #[serde(rename = "transform")] + pub transform: String, +} + +impl TablePartitionKey { + /// One partition key of a table's storage layout. Partitioning groups rows that share a key value into their own files, so a query filtering on that key reads only the matching files. Keys are applied in the order given, and several keys may read the same column: to get one partition per calendar month, declare `year` and `month` on the timestamp column. A single calendar transform on its own is rarely what you want — `month` alone puts every March of every year in one partition. + pub fn new(column: String, transform: String) -> TablePartitionKey { + TablePartitionKey { column, transform } + } +} diff --git a/src/models/table_sort_key.rs b/src/models/table_sort_key.rs new file mode 100644 index 0000000..eafd899 --- /dev/null +++ b/src/models/table_sort_key.rs @@ -0,0 +1,46 @@ +/* + * Hotdata API + * + * Powerful data platform API for managed databases, queries, and analytics. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: developers@hotdata.dev + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// TableSortKey : One key of a table's sort order. Rows are written in this order, which keeps the values in each file within a narrow range and lets queries filtering on those columns skip files entirely. Most useful on columns you filter by ranges, such as a timestamp. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableSortKey { + #[serde(rename = "column")] + pub column: String, + /// `asc` (the default) or `desc`. + #[serde( + rename = "direction", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub direction: Option>, + /// Where nulls are placed: `first` or `last`. Defaults to the SQL default for the chosen direction. + #[serde( + rename = "nulls", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub nulls: Option>, +} + +impl TableSortKey { + /// One key of a table's sort order. Rows are written in this order, which keeps the values in each file within a narrow range and lets queries filtering on those columns skip files entirely. Most useful on columns you filter by ranges, such as a timestamp. + pub fn new(column: String) -> TableSortKey { + TableSortKey { + column, + direction: None, + nulls: None, + } + } +}