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

### Changed

- feat(tables): add csv and json file format support for table loads
- Regenerate the client from the updated Hotdata OpenAPI spec
- chore: remove datasets API and related job types

Expand Down
2 changes: 1 addition & 1 deletion docs/ConnectionsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ This endpoint does not need any parameter.

Load managed table from upload

Publish a previously-uploaded parquet file as the new contents of a managed table. The upload must reference a parquet file. Only `mode = "replace"` is supported. Concurrent loads against the same upload return 409.
Publish a previously-uploaded file as the new contents of a managed table. CSV, JSON, and Parquet uploads are supported; the format is auto-detected from the upload's `Content-Type` and file contents, or set explicitly via the `format` field. Only `mode = "replace"` is supported. Concurrent loads against the same upload return 409.

### Example

Expand Down
96 changes: 96 additions & 0 deletions docs/DatabasesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Method | HTTP request | Description
[**detach_database_catalog**](DatabasesApi.md#detach_database_catalog) | **DELETE** /v1/databases/{database_id}/catalogs/{connection_id} | Detach catalog from database
[**get_database**](DatabasesApi.md#get_database) | **GET** /v1/databases/{database_id} | Get database
[**list_databases**](DatabasesApi.md#list_databases) | **GET** /v1/databases | List databases
[**load_database_table**](DatabasesApi.md#load_database_table) | **POST** /v1/databases/{database_id}/schemas/{schema}/tables/{table}/loads | Load database table from upload


# **add_database_schema**
Expand Down Expand Up @@ -706,3 +707,98 @@ This endpoint does not need any parameter.

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **load_database_table**
> LoadManagedTableResponse load_database_table(database_id, var_schema, table, load_managed_table_request)

Load database table from upload

Publish a previously-uploaded file as the new contents of a table on the database's default catalog. The database-scoped equivalent of the connection-scoped managed-table load — addressed by `database_id`, so no `default_connection_id` is needed. CSV, JSON, and Parquet uploads are supported; the format is auto-detected or set via `format`. Only `mode = "replace"` is supported. Concurrent loads against the same upload return 409.

### Example

* Api Key Authentication (WorkspaceId):
* Bearer Authentication (BearerAuth):

```python
import hotdata
from hotdata.models.load_managed_table_request import LoadManagedTableRequest
from hotdata.models.load_managed_table_response import LoadManagedTableResponse
from hotdata.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.hotdata.dev
# See configuration.py for a list of all supported configuration parameters.
configuration = hotdata.Configuration(
host = "https://api.hotdata.dev"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: WorkspaceId
configuration.api_key['WorkspaceId'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['WorkspaceId'] = 'Bearer'

# Configure Bearer authorization: BearerAuth
configuration = hotdata.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hotdata.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hotdata.DatabasesApi(api_client)
database_id = 'database_id_example' # str | Database ID
var_schema = 'var_schema_example' # str | Schema name
table = 'table_example' # str | Table name
load_managed_table_request = hotdata.LoadManagedTableRequest() # LoadManagedTableRequest |

try:
# Load database table from upload
api_response = api_instance.load_database_table(database_id, var_schema, table, load_managed_table_request)
print("The response of DatabasesApi->load_database_table:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DatabasesApi->load_database_table: %s\n" % e)
```



### Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**database_id** | **str**| Database ID |
**var_schema** | **str**| Schema name |
**table** | **str**| Table name |
**load_managed_table_request** | [**LoadManagedTableRequest**](LoadManagedTableRequest.md)| |

### Return type

[**LoadManagedTableResponse**](LoadManagedTableResponse.md)

### Authorization

[WorkspaceId](../README.md#WorkspaceId), [BearerAuth](../README.md#BearerAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

### HTTP response details

| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Table loaded | - |
**400** | Invalid request (bad mode, bad parquet) | - |
**404** | Database, table, or upload not found | - |
**409** | Upload already consumed or in flight | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions docs/JobType.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ Background job types returned by the API.

* `MANAGED_LOAD` (value: `'managed_load'`)

* `DUCKLAKE_VACUUM` (value: `'ducklake_vacuum'`)

* `DUCKLAKE_ORPHAN_CLEANUP` (value: `'ducklake_orphan_cleanup'`)

* `RESULT_DELETION` (value: `'result_deletion'`)

* `STALE_RESULT_CLEANUP` (value: `'stale_result_cleanup'`)

* `RESULT_RETENTION` (value: `'result_retention'`)

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


5 changes: 3 additions & 2 deletions docs/LoadManagedTableRequest.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# LoadManagedTableRequest

Request body for `POST /v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads`. Publishes a previously-uploaded parquet file as the new contents of the named managed table. `mode` is fixed to `\"replace\"` today; the field is kept in the request body so future modes (e.g. append) are an additive change.
Request body for `POST /v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads`. Publishes a previously-uploaded file as the new contents of the named managed table. CSV and JSON uploads are converted to columnar storage on load; Parquet uploads are published directly. `mode` is fixed to `\"replace\"` today; the field is kept in the request body so future modes (e.g. append) are an additive change.

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**format** | **str** | File format of the upload: `\"csv\"`, `\"json\"`, or `\"parquet\"`. Optional — when omitted, the format is auto-detected from the upload's `Content-Type` and, failing that, from the file contents. Provide it explicitly to override detection or when the contents are ambiguous. `\"json\"` expects newline-delimited JSON (one object per line), not a JSON array. | [optional]
**mode** | **str** | Load mode. Only `\"replace\"` is supported in this release. |
**upload_id** | **str** | ID of a previously-staged upload (see `POST /v1/files`). The upload must reference a parquet file. The upload is claimed atomically; concurrent loads against the same `upload_id` return 409. |
**upload_id** | **str** | ID of a previously-staged upload (see `POST /v1/files`). The upload is claimed atomically; concurrent loads against the same `upload_id` return 409. |

## Example

Expand Down
6 changes: 3 additions & 3 deletions hotdata/api/connections_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2603,7 +2603,7 @@ def load_managed_table(
) -> LoadManagedTableResponse:
"""Load managed table from upload

Publish a previously-uploaded parquet file as the new contents of a managed table. The upload must reference a parquet file. Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409.
Publish a previously-uploaded file as the new contents of a managed table. CSV, JSON, and Parquet uploads are supported; the format is auto-detected from the upload's `Content-Type` and file contents, or set explicitly via the `format` field. Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409.

:param connection_id: Connection ID (required)
:type connection_id: str
Expand Down Expand Up @@ -2685,7 +2685,7 @@ def load_managed_table_with_http_info(
) -> ApiResponse[LoadManagedTableResponse]:
"""Load managed table from upload

Publish a previously-uploaded parquet file as the new contents of a managed table. The upload must reference a parquet file. Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409.
Publish a previously-uploaded file as the new contents of a managed table. CSV, JSON, and Parquet uploads are supported; the format is auto-detected from the upload's `Content-Type` and file contents, or set explicitly via the `format` field. Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409.

:param connection_id: Connection ID (required)
:type connection_id: str
Expand Down Expand Up @@ -2767,7 +2767,7 @@ def load_managed_table_without_preload_content(
) -> RESTResponseType:
"""Load managed table from upload

Publish a previously-uploaded parquet file as the new contents of a managed table. The upload must reference a parquet file. Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409.
Publish a previously-uploaded file as the new contents of a managed table. CSV, JSON, and Parquet uploads are supported; the format is auto-detected from the upload's `Content-Type` and file contents, or set explicitly via the `format` field. Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409.

:param connection_id: Connection ID (required)
:type connection_id: str
Expand Down
Loading