Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: this bullet is the raw commit subject, not the SDK-facing description the rest of the file uses (not blocking). Compare the precedent for the very similar key addition (CHANGELOG.md:82): "AddManagedTableDecl, AddManagedTableRequest, and DatabaseDefaultTableDecl gain an optional key field…". Consumers reading the release notes here don't learn that two new public types (TablePartitionKey, TableSortKey) were added or which models gained fields. Suggest rewording before release, e.g.:

Suggested change
- feat(tables): add partition_by and sorted_by configuration
- `AddManagedTableDecl`, `AddManagedTableRequest`, and `DatabaseDefaultTableDecl`
gain optional `partition_by` and `sorted_by` fields describing a managed
table's storage layout, along with the new `TablePartitionKey` and
`TableSortKey` models. Both are declared at table-create time and fixed
thereafter; omitting them preserves today's behaviour.

- `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
Expand Down
2 changes: 2 additions & 0 deletions docs/AddManagedTableDecl.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**key** | Option<**Vec<String>**> | 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<models::TablePartitionKey>**](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<models::TableSortKey>**](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)

Expand Down
2 changes: 2 additions & 0 deletions docs/AddManagedTableRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**key** | Option<**Vec<String>**> | 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<models::TablePartitionKey>**](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<models::TableSortKey>**](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)

Expand Down
2 changes: 2 additions & 0 deletions docs/DatabaseDefaultTableDecl.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**key** | Option<**Vec<String>**> | 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<models::TablePartitionKey>**](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<models::TableSortKey>**](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)

Expand Down
12 changes: 12 additions & 0 deletions docs/TablePartitionKey.md
Original file line number Diff line number Diff line change
@@ -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)


13 changes: 13 additions & 0 deletions docs/TableSortKey.md
Original file line number Diff line number Diff line change
@@ -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)


13 changes: 12 additions & 1 deletion src/models/add_managed_table_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ pub struct AddManagedTableDecl {
pub key: Option<Vec<String>>,
#[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<Vec<models::TablePartitionKey>>,
/// 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<Vec<models::TableSortKey>>,
}

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,
}
}
}
13 changes: 12 additions & 1 deletion src/models/add_managed_table_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ pub struct AddManagedTableRequest {
pub key: Option<Vec<String>>,
#[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<Vec<models::TablePartitionKey>>,
/// 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<Vec<models::TableSortKey>>,
}

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,
}
}
}
13 changes: 12 additions & 1 deletion src/models/database_default_table_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ pub struct DatabaseDefaultTableDecl {
pub key: Option<Vec<String>>,
#[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<Vec<models::TablePartitionKey>>,
/// 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<Vec<models::TableSortKey>>,
}

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,
}
}
}
4 changes: 4 additions & 0 deletions src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 30 additions & 0 deletions src/models/table_partition_key.rs
Original file line number Diff line number Diff line change
@@ -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: [email protected]
* 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 }
}
}
46 changes: 46 additions & 0 deletions src/models/table_sort_key.rs
Original file line number Diff line number Diff line change
@@ -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: [email protected]
* 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<Option<String>>,
/// 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<Option<String>>,
}

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,
}
}
}
Loading