Skip to content
Closed
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- feat(databases): add default_schema field to database objects

## [0.8.1] - 2026-07-09

Expand Down
1 change: 1 addition & 0 deletions docs/AddManagedTableDecl.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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** | |

[[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
1 change: 1 addition & 0 deletions docs/AddManagedTableRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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** | |

[[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
1 change: 1 addition & 0 deletions docs/CreateDatabaseRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**default_catalog** | Option<**String**> | Optional name the database's auto-created default catalog answers to inside its query scope. Must be a valid SQL identifier (`[a-z0-9_]`, not starting with a digit) and may not collide with the reserved catalog names `hotdata`, `datasets`, or `information_schema`. Defaults to `default` when omitted, so `default.main.<table>` keeps working. | [optional]
**default_schema** | Option<**String**> | Optional schema that unqualified table names resolve to inside this database's query scope. Must be a valid SQL identifier (`[a-z0-9_]`, not starting with a digit). When omitted, a database that declares exactly one schema adopts that schema as its default; otherwise unqualified names resolve to `main`. Fully-qualified names (`<catalog>.<schema>.<table>`) are unaffected, and a per-query `default_schema` still takes precedence. | [optional]
**expires_at** | Option<**String**> | When this database expires. Accepts either an RFC 3339 timestamp (e.g. `\"2026-06-01T00:00:00Z\"`) or a relative duration suffixed with `h` (hours), `m` (minutes), or `d` (days) — for example `\"24h\"`, `\"48h\"`, or `\"7d\"`. Omitted (or empty) means the database never expires. Expiry is best-effort: the database will not be deleted before `expires_at`, but cleanup may run later than the exact timestamp. | [optional]
**name** | Option<**String**> | Optional free-form display label (for UIs/CLIs). Not unique. Not an identifier — databases are always addressed by `id`. Accepts the legacy `description` key as an alias so clients that predate the rename keep populating this field. | [optional]
**schemas** | Option<[**Vec<models::DatabaseDefaultSchemaDecl>**](DatabaseDefaultSchemaDecl.md)> | Optional schemas/tables to declare on the database's auto-created default catalog. Tables declared here can be loaded via the standard managed-table load endpoint targeting `default_connection_id`. Omitted or empty means the default catalog starts empty. | [optional]
Expand Down
1 change: 1 addition & 0 deletions docs/CreateDatabaseResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**default_catalog** | **String** | Name the database's default catalog answers to inside its query scope (`default` unless overridden at create time). |
**default_connection_id** | **String** | Internal id of the connection that backs this database's `default` catalog. Workspace-level connection endpoints (list, get, health, delete, cache purge) refuse to act on this id — it is exposed only for the managed-tables load endpoint (`POST /v1/connections/{id}/schemas/{s}/tables/{t}/loads`) so callers can publish parquet into tables declared at database-create time. Addressing it directly in SQL is not the recommended path — use `default` inside an `X-Database-Id` scope instead. |
**default_schema** | **String** | Schema that unqualified table names resolve to inside this database's query scope. `main` unless the database declares a single schema or a `default_schema` was set at create time. |
**expires_at** | Option<**String**> | When this database expires. | [optional]
**id** | **String** | |
**name** | Option<**String**> | | [optional]
Expand Down
1 change: 1 addition & 0 deletions docs/DatabaseDefaultTableDecl.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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** | |

[[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
1 change: 1 addition & 0 deletions docs/DatabaseDetailResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name | Type | Description | Notes
**created_at** | Option<**String**> | When the database was created. | [optional]
**default_catalog** | **String** | Name the database's default catalog answers to inside its query scope (`default` unless overridden at create time). |
**default_connection_id** | **String** | |
**default_schema** | **String** | Schema that unqualified table names resolve to inside this database's query scope. `main` unless the database declares a single schema or a `default_schema` was set at create time. |
**expires_at** | Option<**String**> | When this database expires. | [optional]
**id** | **String** | |
**name** | Option<**String**> | | [optional]
Expand Down
1 change: 1 addition & 0 deletions docs/DatabaseSummary.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**created_at** | Option<**String**> | When the database was created. | [optional]
**default_catalog** | **String** | Name the database's default catalog answers to inside its query scope. |
**default_schema** | **String** | Schema that unqualified table names resolve to inside this database's query scope. `main` unless the database declares a single schema or a `default_schema` was set at create time. |
**expires_at** | Option<**String**> | | [optional]
**id** | **String** | |
**name** | Option<**String**> | | [optional]
Expand Down
5 changes: 4 additions & 1 deletion src/models/add_managed_table_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ use serde::{Deserialize, Serialize};
/// AddManagedTableDecl : One table declaration inside an add-schema request body.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AddManagedTableDecl {
/// 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>>,
#[serde(rename = "name")]
pub name: String,
}

impl AddManagedTableDecl {
/// One table declaration inside an add-schema request body.
pub fn new(name: String) -> AddManagedTableDecl {
AddManagedTableDecl { name }
AddManagedTableDecl { key: None, name }
}
}
5 changes: 4 additions & 1 deletion src/models/add_managed_table_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ 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>>,
#[serde(rename = "name")]
pub name: String,
}

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 { name }
AddManagedTableRequest { key: None, name }
}
}
9 changes: 9 additions & 0 deletions src/models/create_database_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ pub struct CreateDatabaseRequest {
skip_serializing_if = "Option::is_none"
)]
pub default_catalog: Option<Option<String>>,
/// Optional schema that unqualified table names resolve to inside this database's query scope. Must be a valid SQL identifier (`[a-z0-9_]`, not starting with a digit). When omitted, a database that declares exactly one schema adopts that schema as its default; otherwise unqualified names resolve to `main`. Fully-qualified names (`<catalog>.<schema>.<table>`) are unaffected, and a per-query `default_schema` still takes precedence.
#[serde(
rename = "default_schema",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub default_schema: Option<Option<String>>,
/// When this database expires. Accepts either an RFC 3339 timestamp (e.g. `\"2026-06-01T00:00:00Z\"`) or a relative duration suffixed with `h` (hours), `m` (minutes), or `d` (days) — for example `\"24h\"`, `\"48h\"`, or `\"7d\"`. Omitted (or empty) means the database never expires. Expiry is best-effort: the database will not be deleted before `expires_at`, but cleanup may run later than the exact timestamp.
#[serde(
rename = "expires_at",
Expand All @@ -48,6 +56,7 @@ impl CreateDatabaseRequest {
pub fn new() -> CreateDatabaseRequest {
CreateDatabaseRequest {
default_catalog: None,
default_schema: None,
expires_at: None,
name: None,
schemas: None,
Expand Down
5 changes: 5 additions & 0 deletions src/models/create_database_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub struct CreateDatabaseResponse {
/// Internal id of the connection that backs this database's `default` catalog. Workspace-level connection endpoints (list, get, health, delete, cache purge) refuse to act on this id — it is exposed only for the managed-tables load endpoint (`POST /v1/connections/{id}/schemas/{s}/tables/{t}/loads`) so callers can publish parquet into tables declared at database-create time. Addressing it directly in SQL is not the recommended path — use `default` inside an `X-Database-Id` scope instead.
#[serde(rename = "default_connection_id")]
pub default_connection_id: String,
/// Schema that unqualified table names resolve to inside this database's query scope. `main` unless the database declares a single schema or a `default_schema` was set at create time.
#[serde(rename = "default_schema")]
pub default_schema: String,
/// When this database expires.
#[serde(
rename = "expires_at",
Expand All @@ -44,11 +47,13 @@ impl CreateDatabaseResponse {
pub fn new(
default_catalog: String,
default_connection_id: String,
default_schema: String,
id: String,
) -> CreateDatabaseResponse {
CreateDatabaseResponse {
default_catalog,
default_connection_id,
default_schema,
expires_at: None,
id,
name: None,
Expand Down
5 changes: 4 additions & 1 deletion src/models/database_default_table_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ use serde::{Deserialize, Serialize};
/// DatabaseDefaultTableDecl : One table declaration inside a default-catalog schema, supplied at database-create time.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DatabaseDefaultTableDecl {
/// 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>>,
#[serde(rename = "name")]
pub name: String,
}

impl DatabaseDefaultTableDecl {
/// One table declaration inside a default-catalog schema, supplied at database-create time.
pub fn new(name: String) -> DatabaseDefaultTableDecl {
DatabaseDefaultTableDecl { name }
DatabaseDefaultTableDecl { key: None, name }
}
}
5 changes: 5 additions & 0 deletions src/models/database_detail_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ pub struct DatabaseDetailResponse {
pub default_catalog: String,
#[serde(rename = "default_connection_id")]
pub default_connection_id: String,
/// Schema that unqualified table names resolve to inside this database's query scope. `main` unless the database declares a single schema or a `default_schema` was set at create time.
#[serde(rename = "default_schema")]
pub default_schema: String,
/// When this database expires.
#[serde(
rename = "expires_at",
Expand All @@ -54,13 +57,15 @@ impl DatabaseDetailResponse {
attachments: Vec<models::DatabaseAttachmentInfo>,
default_catalog: String,
default_connection_id: String,
default_schema: String,
id: String,
) -> DatabaseDetailResponse {
DatabaseDetailResponse {
attachments,
created_at: None,
default_catalog,
default_connection_id,
default_schema,
expires_at: None,
id,
name: None,
Expand Down
6 changes: 5 additions & 1 deletion src/models/database_summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ pub struct DatabaseSummary {
/// Name the database's default catalog answers to inside its query scope.
#[serde(rename = "default_catalog")]
pub default_catalog: String,
/// Schema that unqualified table names resolve to inside this database's query scope. `main` unless the database declares a single schema or a `default_schema` was set at create time.
#[serde(rename = "default_schema")]
pub default_schema: String,
#[serde(
rename = "expires_at",
default,
Expand All @@ -45,10 +48,11 @@ pub struct DatabaseSummary {

impl DatabaseSummary {
/// Summary item in GET /databases
pub fn new(default_catalog: String, id: String) -> DatabaseSummary {
pub fn new(default_catalog: String, default_schema: String, id: String) -> DatabaseSummary {
DatabaseSummary {
created_at: None,
default_catalog,
default_schema,
expires_at: None,
id,
name: None,
Expand Down
Loading