hotdata 0.15.0

Powerful data platform API for datasets, queries, and analytics.
Documentation
/*
 * Hotdata API
 *
 * Powerful data platform API for instant 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};

/// 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`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AddManagedTableRequest {
    /// 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.
    #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
    pub key: Option<Vec<String>>,
    /// Columns whose value is determined by this table's `key`: for every uploaded row, every stored row sharing its key holds the same value of these columns.  Declaring this lets a keyed mutation (`delete`, `update`, `upsert`) restrict its search for prior versions to the values the upload carries, which prunes far harder than the key alone when the key's own file statistics are weak. Omit (the default) for the unrestricted search.  **Correctness-affecting, not a hint.** If the assertion is false, a mutation supersedes one version of a key and appends beside another, silently duplicating it. Declare it only where the invariant is established.
    #[serde(rename = "key_determines", skip_serializing_if = "Option::is_none")]
    pub key_determines: 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,
            key_determines: None,
            name,
            partition_by: None,
            sorted_by: None,
        }
    }
}