diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 2ec0f16..d8d632e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -4,6 +4,7 @@ docs/ApiErrorDetail.md docs/ApiErrorResponse.md docs/AsyncQueryResponse.md +docs/AttachDatabaseCatalogRequest.md docs/BooleanProfileDetail.md docs/CategoricalProfileDetail.md docs/CategoryValueInfo.md @@ -26,6 +27,8 @@ docs/ConnectionTypesApi.md docs/ConnectionsApi.md docs/CreateConnectionRequest.md docs/CreateConnectionResponse.md +docs/CreateDatabaseRequest.md +docs/CreateDatabaseResponse.md docs/CreateDatasetRequest.md docs/CreateDatasetResponse.md docs/CreateEmbeddingProviderRequest.md @@ -37,6 +40,12 @@ docs/CreateSecretRequest.md docs/CreateSecretResponse.md docs/CreateWorkspaceRequest.md docs/CreateWorkspaceResponse.md +docs/DatabaseAttachmentInfo.md +docs/DatabaseDefaultSchemaDecl.md +docs/DatabaseDefaultTableDecl.md +docs/DatabaseDetailResponse.md +docs/DatabaseSummary.md +docs/DatabasesApi.md docs/DatasetSource.md docs/DatasetSourceOneOf.md docs/DatasetSourceOneOf1.md @@ -71,6 +80,7 @@ docs/JobType.md docs/JobsApi.md docs/ListConnectionTypesResponse.md docs/ListConnectionsResponse.md +docs/ListDatabasesResponse.md docs/ListDatasetVersionsResponse.md docs/ListDatasetsResponse.md docs/ListEmbeddingProvidersResponse.md @@ -144,6 +154,7 @@ hotdata/__init__.py hotdata/api/__init__.py hotdata/api/connection_types_api.py hotdata/api/connections_api.py +hotdata/api/databases_api.py hotdata/api/datasets_api.py hotdata/api/embedding_providers_api.py hotdata/api/indexes_api.py @@ -167,6 +178,7 @@ hotdata/models/__init__.py hotdata/models/api_error_detail.py hotdata/models/api_error_response.py hotdata/models/async_query_response.py +hotdata/models/attach_database_catalog_request.py hotdata/models/boolean_profile_detail.py hotdata/models/categorical_profile_detail.py hotdata/models/category_value_info.py @@ -187,6 +199,8 @@ hotdata/models/connection_type_detail.py hotdata/models/connection_type_summary.py hotdata/models/create_connection_request.py hotdata/models/create_connection_response.py +hotdata/models/create_database_request.py +hotdata/models/create_database_response.py hotdata/models/create_dataset_request.py hotdata/models/create_dataset_response.py hotdata/models/create_embedding_provider_request.py @@ -198,6 +212,11 @@ hotdata/models/create_secret_request.py hotdata/models/create_secret_response.py hotdata/models/create_workspace_request.py hotdata/models/create_workspace_response.py +hotdata/models/database_attachment_info.py +hotdata/models/database_default_schema_decl.py +hotdata/models/database_default_table_decl.py +hotdata/models/database_detail_response.py +hotdata/models/database_summary.py hotdata/models/dataset_source.py hotdata/models/dataset_source_one_of.py hotdata/models/dataset_source_one_of1.py @@ -227,6 +246,7 @@ hotdata/models/job_status_response.py hotdata/models/job_type.py hotdata/models/list_connection_types_response.py hotdata/models/list_connections_response.py +hotdata/models/list_databases_response.py hotdata/models/list_dataset_versions_response.py hotdata/models/list_datasets_response.py hotdata/models/list_embedding_providers_response.py @@ -293,4 +313,14 @@ requirements.txt setup.cfg test-requirements.txt test/__init__.py +test/test_attach_database_catalog_request.py +test/test_create_database_request.py +test/test_create_database_response.py +test/test_database_attachment_info.py +test/test_database_default_schema_decl.py +test/test_database_default_table_decl.py +test/test_database_detail_response.py +test/test_database_summary.py +test/test_databases_api.py +test/test_list_databases_response.py tox.ini diff --git a/docs/AttachDatabaseCatalogRequest.md b/docs/AttachDatabaseCatalogRequest.md new file mode 100644 index 0000000..a0fc4f1 --- /dev/null +++ b/docs/AttachDatabaseCatalogRequest.md @@ -0,0 +1,31 @@ +# AttachDatabaseCatalogRequest + +Request body for POST /databases/{database_id}/catalogs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**alias** | **str** | Optional alias under which this catalog is reachable inside the database. When omitted, it is reachable by the connection's name. | [optional] +**connection_id** | **str** | | + +## Example + +```python +from hotdata.models.attach_database_catalog_request import AttachDatabaseCatalogRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of AttachDatabaseCatalogRequest from a JSON string +attach_database_catalog_request_instance = AttachDatabaseCatalogRequest.from_json(json) +# print the JSON string representation of the object +print(AttachDatabaseCatalogRequest.to_json()) + +# convert the object into a dict +attach_database_catalog_request_dict = attach_database_catalog_request_instance.to_dict() +# create an instance of AttachDatabaseCatalogRequest from a dict +attach_database_catalog_request_from_dict = AttachDatabaseCatalogRequest.from_dict(attach_database_catalog_request_dict) +``` +[[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/ConnectionsApi.md b/docs/ConnectionsApi.md index 35ffd8c..a633983 100644 --- a/docs/ConnectionsApi.md +++ b/docs/ConnectionsApi.md @@ -270,6 +270,7 @@ void (empty response body) |-------------|-------------|------------------| **204** | Connection deleted | - | **404** | Connection not found | - | +**409** | Connection backs a database's default catalog and cannot be deleted directly | - | [[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) @@ -792,7 +793,9 @@ void (empty response body) | Status code | Description | Response headers | |-------------|-------------|------------------| **204** | Cache purged | - | +**400** | Managed catalogs own their parquet generations and cannot be purged | - | **404** | Connection not found | - | +**409** | Connection backs a database's default catalog and cannot be purged directly | - | [[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) diff --git a/docs/CreateDatabaseRequest.md b/docs/CreateDatabaseRequest.md new file mode 100644 index 0000000..460707d --- /dev/null +++ b/docs/CreateDatabaseRequest.md @@ -0,0 +1,31 @@ +# CreateDatabaseRequest + +Request body for POST /databases + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **str** | Optional free-form display label (for UIs/CLIs). Not unique. Not an identifier — databases are always addressed by `id`. | [optional] +**schemas** | [**List[DatabaseDefaultSchemaDecl]**](DatabaseDefaultSchemaDecl.md) | Optional schemas/tables to declare on the database's auto-created `default` catalog. Mirrors the `config.schemas` field of a managed `POST /v1/connections`. 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] + +## Example + +```python +from hotdata.models.create_database_request import CreateDatabaseRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateDatabaseRequest from a JSON string +create_database_request_instance = CreateDatabaseRequest.from_json(json) +# print the JSON string representation of the object +print(CreateDatabaseRequest.to_json()) + +# convert the object into a dict +create_database_request_dict = create_database_request_instance.to_dict() +# create an instance of CreateDatabaseRequest from a dict +create_database_request_from_dict = CreateDatabaseRequest.from_dict(create_database_request_dict) +``` +[[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/CreateDatabaseResponse.md b/docs/CreateDatabaseResponse.md new file mode 100644 index 0000000..183ec27 --- /dev/null +++ b/docs/CreateDatabaseResponse.md @@ -0,0 +1,32 @@ +# CreateDatabaseResponse + +Response body for POST /databases + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**default_connection_id** | **str** | 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. | +**description** | **str** | | [optional] +**id** | **str** | | + +## Example + +```python +from hotdata.models.create_database_response import CreateDatabaseResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateDatabaseResponse from a JSON string +create_database_response_instance = CreateDatabaseResponse.from_json(json) +# print the JSON string representation of the object +print(CreateDatabaseResponse.to_json()) + +# convert the object into a dict +create_database_response_dict = create_database_response_instance.to_dict() +# create an instance of CreateDatabaseResponse from a dict +create_database_response_from_dict = CreateDatabaseResponse.from_dict(create_database_response_dict) +``` +[[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/DatabaseAttachmentInfo.md b/docs/DatabaseAttachmentInfo.md new file mode 100644 index 0000000..66d1094 --- /dev/null +++ b/docs/DatabaseAttachmentInfo.md @@ -0,0 +1,31 @@ +# DatabaseAttachmentInfo + +One attached catalog inside a database. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**alias** | **str** | Alias under which this catalog is reachable inside the database. When `None`, the catalog is reachable by its original connection name. | [optional] +**connection_id** | **str** | | + +## Example + +```python +from hotdata.models.database_attachment_info import DatabaseAttachmentInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of DatabaseAttachmentInfo from a JSON string +database_attachment_info_instance = DatabaseAttachmentInfo.from_json(json) +# print the JSON string representation of the object +print(DatabaseAttachmentInfo.to_json()) + +# convert the object into a dict +database_attachment_info_dict = database_attachment_info_instance.to_dict() +# create an instance of DatabaseAttachmentInfo from a dict +database_attachment_info_from_dict = DatabaseAttachmentInfo.from_dict(database_attachment_info_dict) +``` +[[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/DatabaseDefaultSchemaDecl.md b/docs/DatabaseDefaultSchemaDecl.md new file mode 100644 index 0000000..0ccc869 --- /dev/null +++ b/docs/DatabaseDefaultSchemaDecl.md @@ -0,0 +1,31 @@ +# DatabaseDefaultSchemaDecl + +One schema declaration inside the database's default catalog at create time. Mirrors `crate::source::ManagedSchemaDecl`. Tables default to empty so callers can declare just a schema name and add tables later via the managed-tables API on the default connection. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**tables** | [**List[DatabaseDefaultTableDecl]**](DatabaseDefaultTableDecl.md) | | [optional] + +## Example + +```python +from hotdata.models.database_default_schema_decl import DatabaseDefaultSchemaDecl + +# TODO update the JSON string below +json = "{}" +# create an instance of DatabaseDefaultSchemaDecl from a JSON string +database_default_schema_decl_instance = DatabaseDefaultSchemaDecl.from_json(json) +# print the JSON string representation of the object +print(DatabaseDefaultSchemaDecl.to_json()) + +# convert the object into a dict +database_default_schema_decl_dict = database_default_schema_decl_instance.to_dict() +# create an instance of DatabaseDefaultSchemaDecl from a dict +database_default_schema_decl_from_dict = DatabaseDefaultSchemaDecl.from_dict(database_default_schema_decl_dict) +``` +[[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 new file mode 100644 index 0000000..8bd348d --- /dev/null +++ b/docs/DatabaseDefaultTableDecl.md @@ -0,0 +1,30 @@ +# DatabaseDefaultTableDecl + +One table declaration inside a default-catalog schema at database-create time. Mirrors `crate::source::ManagedTableDecl` shape so the controller can convert with a simple `.map`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | + +## Example + +```python +from hotdata.models.database_default_table_decl import DatabaseDefaultTableDecl + +# TODO update the JSON string below +json = "{}" +# create an instance of DatabaseDefaultTableDecl from a JSON string +database_default_table_decl_instance = DatabaseDefaultTableDecl.from_json(json) +# print the JSON string representation of the object +print(DatabaseDefaultTableDecl.to_json()) + +# convert the object into a dict +database_default_table_decl_dict = database_default_table_decl_instance.to_dict() +# create an instance of DatabaseDefaultTableDecl from a dict +database_default_table_decl_from_dict = DatabaseDefaultTableDecl.from_dict(database_default_table_decl_dict) +``` +[[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/DatabaseDetailResponse.md b/docs/DatabaseDetailResponse.md new file mode 100644 index 0000000..7fb562b --- /dev/null +++ b/docs/DatabaseDetailResponse.md @@ -0,0 +1,33 @@ +# DatabaseDetailResponse + +Response body for GET /databases/{database_id} + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attachments** | [**List[DatabaseAttachmentInfo]**](DatabaseAttachmentInfo.md) | | +**default_connection_id** | **str** | | +**description** | **str** | | [optional] +**id** | **str** | | + +## Example + +```python +from hotdata.models.database_detail_response import DatabaseDetailResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of DatabaseDetailResponse from a JSON string +database_detail_response_instance = DatabaseDetailResponse.from_json(json) +# print the JSON string representation of the object +print(DatabaseDetailResponse.to_json()) + +# convert the object into a dict +database_detail_response_dict = database_detail_response_instance.to_dict() +# create an instance of DatabaseDetailResponse from a dict +database_detail_response_from_dict = DatabaseDetailResponse.from_dict(database_detail_response_dict) +``` +[[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/DatabaseSummary.md b/docs/DatabaseSummary.md new file mode 100644 index 0000000..c754a17 --- /dev/null +++ b/docs/DatabaseSummary.md @@ -0,0 +1,31 @@ +# DatabaseSummary + +Summary item in GET /databases + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **str** | | [optional] +**id** | **str** | | + +## Example + +```python +from hotdata.models.database_summary import DatabaseSummary + +# TODO update the JSON string below +json = "{}" +# create an instance of DatabaseSummary from a JSON string +database_summary_instance = DatabaseSummary.from_json(json) +# print the JSON string representation of the object +print(DatabaseSummary.to_json()) + +# convert the object into a dict +database_summary_dict = database_summary_instance.to_dict() +# create an instance of DatabaseSummary from a dict +database_summary_from_dict = DatabaseSummary.from_dict(database_summary_dict) +``` +[[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/DatabasesApi.md b/docs/DatabasesApi.md new file mode 100644 index 0000000..1a8ee17 --- /dev/null +++ b/docs/DatabasesApi.md @@ -0,0 +1,522 @@ +# hotdata.DatabasesApi + +All URIs are relative to *https://api.hotdata.dev* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**attach_database_catalog**](DatabasesApi.md#attach_database_catalog) | **POST** /v1/databases/{database_id}/catalogs | Attach catalog to database +[**create_database**](DatabasesApi.md#create_database) | **POST** /v1/databases | Create database +[**delete_database**](DatabasesApi.md#delete_database) | **DELETE** /v1/databases/{database_id} | Delete database +[**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 + + +# **attach_database_catalog** +> attach_database_catalog(database_id, attach_database_catalog_request) + +Attach catalog to database + +Attach an existing connection (catalog) to a database with an optional alias. Inside the database the catalog is reachable as the alias (when set) or its original name. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.attach_database_catalog_request import AttachDatabaseCatalogRequest +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 + attach_database_catalog_request = hotdata.AttachDatabaseCatalogRequest() # AttachDatabaseCatalogRequest | + + try: + # Attach catalog to database + api_instance.attach_database_catalog(database_id, attach_database_catalog_request) + except Exception as e: + print("Exception when calling DatabasesApi->attach_database_catalog: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **database_id** | **str**| Database ID | + **attach_database_catalog_request** | [**AttachDatabaseCatalogRequest**](AttachDatabaseCatalogRequest.md)| | + +### Return type + +void (empty response body) + +### 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 | +|-------------|-------------|------------------| +**204** | Catalog attached | - | +**400** | Invalid request | - | +**404** | Database or connection not found | - | +**409** | Catalog already attached or alias collides with an existing attachment | - | + +[[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) + +# **create_database** +> CreateDatabaseResponse create_database(create_database_request) + +Create database + +Create a new database (a metadata-only grouping). A managed default catalog is auto-created and addressable inside the database as `default`. The optional `description` is a free-form display label and is not required to be unique. Optional `schemas` declares schemas/tables on the default catalog at create time; declared tables can be loaded via the standard managed-tables-load endpoint targeting `default_connection_id`. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.create_database_request import CreateDatabaseRequest +from hotdata.models.create_database_response import CreateDatabaseResponse +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) + create_database_request = hotdata.CreateDatabaseRequest() # CreateDatabaseRequest | + + try: + # Create database + api_response = api_instance.create_database(create_database_request) + print("The response of DatabasesApi->create_database:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DatabasesApi->create_database: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_database_request** | [**CreateDatabaseRequest**](CreateDatabaseRequest.md)| | + +### Return type + +[**CreateDatabaseResponse**](CreateDatabaseResponse.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 | +|-------------|-------------|------------------| +**201** | Database created | - | +**400** | Invalid request | - | +**500** | Internal server error (e.g., managed-connection create succeeded but database row insert + rollback both failed) | - | + +[[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) + +# **delete_database** +> delete_database(database_id) + +Delete database + +Delete a database and its auto-created default catalog. Attached catalogs are detached (their underlying connections are not deleted). + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +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 + + try: + # Delete database + api_instance.delete_database(database_id) + except Exception as e: + print("Exception when calling DatabasesApi->delete_database: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **database_id** | **str**| Database ID | + +### Return type + +void (empty response body) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Database deleted | - | +**404** | Database not found | - | + +[[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) + +# **detach_database_catalog** +> detach_database_catalog(database_id, connection_id) + +Detach catalog from database + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +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 + connection_id = 'connection_id_example' # str | Connection ID + + try: + # Detach catalog from database + api_instance.detach_database_catalog(database_id, connection_id) + except Exception as e: + print("Exception when calling DatabasesApi->detach_database_catalog: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **database_id** | **str**| Database ID | + **connection_id** | **str**| Connection ID | + +### Return type + +void (empty response body) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Catalog detached | - | +**400** | Cannot detach a database's own default catalog | - | +**404** | Database or attachment not found | - | + +[[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) + +# **get_database** +> DatabaseDetailResponse get_database(database_id) + +Get database + +Fetch a database by id. The `description` field is a display label only; it is not accepted as an identifier here. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.database_detail_response import DatabaseDetailResponse +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 + + try: + # Get database + api_response = api_instance.get_database(database_id) + print("The response of DatabasesApi->get_database:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DatabasesApi->get_database: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **database_id** | **str**| Database ID | + +### Return type + +[**DatabaseDetailResponse**](DatabaseDetailResponse.md) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Database details | - | +**404** | Database not found | - | + +[[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) + +# **list_databases** +> ListDatabasesResponse list_databases() + +List databases + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.list_databases_response import ListDatabasesResponse +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) + + try: + # List databases + api_response = api_instance.list_databases() + print("The response of DatabasesApi->list_databases:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DatabasesApi->list_databases: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**ListDatabasesResponse**](ListDatabasesResponse.md) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List of databases | - | + +[[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) + diff --git a/docs/ListDatabasesResponse.md b/docs/ListDatabasesResponse.md new file mode 100644 index 0000000..0b348c2 --- /dev/null +++ b/docs/ListDatabasesResponse.md @@ -0,0 +1,30 @@ +# ListDatabasesResponse + +Response body for GET /databases + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**databases** | [**List[DatabaseSummary]**](DatabaseSummary.md) | | + +## Example + +```python +from hotdata.models.list_databases_response import ListDatabasesResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ListDatabasesResponse from a JSON string +list_databases_response_instance = ListDatabasesResponse.from_json(json) +# print the JSON string representation of the object +print(ListDatabasesResponse.to_json()) + +# convert the object into a dict +list_databases_response_dict = list_databases_response_instance.to_dict() +# create an instance of ListDatabasesResponse from a dict +list_databases_response_from_dict = ListDatabasesResponse.from_dict(list_databases_response_dict) +``` +[[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/QueryApi.md b/docs/QueryApi.md index 30f9d98..60e285e 100644 --- a/docs/QueryApi.md +++ b/docs/QueryApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **query** -> QueryResponse query(query_request) +> QueryResponse query(query_request, x_database_id=x_database_id) Execute SQL query @@ -16,6 +16,8 @@ Execute a SQL query against all registered connections and datasets. Use standar Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout. +Set the `X-Database-Id` header to scope the query to a specific database. Inside a database scope the query only sees that database's auto `default` catalog plus any catalogs explicitly attached to it; workspace catalogs are invisible. + ### Example * Api Key Authentication (WorkspaceId): @@ -62,10 +64,11 @@ with hotdata.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = hotdata.QueryApi(api_client) query_request = hotdata.QueryRequest() # QueryRequest | + x_database_id = 'x_database_id_example' # str | Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404. (optional) try: # Execute SQL query - api_response = api_instance.query(query_request) + api_response = api_instance.query(query_request, x_database_id=x_database_id) print("The response of QueryApi->query:\n") pprint(api_response) except Exception as e: @@ -80,6 +83,7 @@ with hotdata.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **query_request** | [**QueryRequest**](QueryRequest.md)| | + **x_database_id** | **str**| Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404. | [optional] ### Return type @@ -101,6 +105,7 @@ Name | Type | Description | Notes **200** | Query executed successfully | - | **202** | Query submitted asynchronously | - | **400** | Invalid request | - | +**404** | Database (from X-Database-Id) not found | - | **500** | Internal server error | - | [[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) diff --git a/hotdata/__init__.py b/hotdata/__init__.py index 5481fe2..620edb2 100644 --- a/hotdata/__init__.py +++ b/hotdata/__init__.py @@ -26,6 +26,7 @@ __all__ = [ "ConnectionTypesApi", "ConnectionsApi", + "DatabasesApi", "DatasetsApi", "EmbeddingProvidersApi", "IndexesApi", @@ -53,6 +54,7 @@ "ApiErrorDetail", "ApiErrorResponse", "AsyncQueryResponse", + "AttachDatabaseCatalogRequest", "BooleanProfileDetail", "CategoricalProfileDetail", "CategoryValueInfo", @@ -73,6 +75,8 @@ "ConnectionTypeSummary", "CreateConnectionRequest", "CreateConnectionResponse", + "CreateDatabaseRequest", + "CreateDatabaseResponse", "CreateDatasetRequest", "CreateDatasetResponse", "CreateEmbeddingProviderRequest", @@ -84,6 +88,11 @@ "CreateSecretResponse", "CreateWorkspaceRequest", "CreateWorkspaceResponse", + "DatabaseAttachmentInfo", + "DatabaseDefaultSchemaDecl", + "DatabaseDefaultTableDecl", + "DatabaseDetailResponse", + "DatabaseSummary", "DatasetSource", "DatasetSourceOneOf", "DatasetSourceOneOf1", @@ -113,6 +122,7 @@ "JobType", "ListConnectionTypesResponse", "ListConnectionsResponse", + "ListDatabasesResponse", "ListDatasetVersionsResponse", "ListDatasetsResponse", "ListEmbeddingProvidersResponse", @@ -177,6 +187,7 @@ # import apis into sdk package from hotdata.api.connection_types_api import ConnectionTypesApi as ConnectionTypesApi from hotdata.api.connections_api import ConnectionsApi as ConnectionsApi +from hotdata.api.databases_api import DatabasesApi as DatabasesApi from hotdata.api.datasets_api import DatasetsApi as DatasetsApi from hotdata.api.embedding_providers_api import EmbeddingProvidersApi as EmbeddingProvidersApi from hotdata.api.indexes_api import IndexesApi as IndexesApi @@ -208,6 +219,7 @@ from hotdata.models.api_error_detail import ApiErrorDetail as ApiErrorDetail from hotdata.models.api_error_response import ApiErrorResponse as ApiErrorResponse from hotdata.models.async_query_response import AsyncQueryResponse as AsyncQueryResponse +from hotdata.models.attach_database_catalog_request import AttachDatabaseCatalogRequest as AttachDatabaseCatalogRequest from hotdata.models.boolean_profile_detail import BooleanProfileDetail as BooleanProfileDetail from hotdata.models.categorical_profile_detail import CategoricalProfileDetail as CategoricalProfileDetail from hotdata.models.category_value_info import CategoryValueInfo as CategoryValueInfo @@ -228,6 +240,8 @@ from hotdata.models.connection_type_summary import ConnectionTypeSummary as ConnectionTypeSummary from hotdata.models.create_connection_request import CreateConnectionRequest as CreateConnectionRequest from hotdata.models.create_connection_response import CreateConnectionResponse as CreateConnectionResponse +from hotdata.models.create_database_request import CreateDatabaseRequest as CreateDatabaseRequest +from hotdata.models.create_database_response import CreateDatabaseResponse as CreateDatabaseResponse from hotdata.models.create_dataset_request import CreateDatasetRequest as CreateDatasetRequest from hotdata.models.create_dataset_response import CreateDatasetResponse as CreateDatasetResponse from hotdata.models.create_embedding_provider_request import CreateEmbeddingProviderRequest as CreateEmbeddingProviderRequest @@ -239,6 +253,11 @@ from hotdata.models.create_secret_response import CreateSecretResponse as CreateSecretResponse from hotdata.models.create_workspace_request import CreateWorkspaceRequest as CreateWorkspaceRequest from hotdata.models.create_workspace_response import CreateWorkspaceResponse as CreateWorkspaceResponse +from hotdata.models.database_attachment_info import DatabaseAttachmentInfo as DatabaseAttachmentInfo +from hotdata.models.database_default_schema_decl import DatabaseDefaultSchemaDecl as DatabaseDefaultSchemaDecl +from hotdata.models.database_default_table_decl import DatabaseDefaultTableDecl as DatabaseDefaultTableDecl +from hotdata.models.database_detail_response import DatabaseDetailResponse as DatabaseDetailResponse +from hotdata.models.database_summary import DatabaseSummary as DatabaseSummary from hotdata.models.dataset_source import DatasetSource as DatasetSource from hotdata.models.dataset_source_one_of import DatasetSourceOneOf as DatasetSourceOneOf from hotdata.models.dataset_source_one_of1 import DatasetSourceOneOf1 as DatasetSourceOneOf1 @@ -268,6 +287,7 @@ from hotdata.models.job_type import JobType as JobType from hotdata.models.list_connection_types_response import ListConnectionTypesResponse as ListConnectionTypesResponse from hotdata.models.list_connections_response import ListConnectionsResponse as ListConnectionsResponse +from hotdata.models.list_databases_response import ListDatabasesResponse as ListDatabasesResponse from hotdata.models.list_dataset_versions_response import ListDatasetVersionsResponse as ListDatasetVersionsResponse from hotdata.models.list_datasets_response import ListDatasetsResponse as ListDatasetsResponse from hotdata.models.list_embedding_providers_response import ListEmbeddingProvidersResponse as ListEmbeddingProvidersResponse diff --git a/hotdata/api/__init__.py b/hotdata/api/__init__.py index 154b6b5..0cac8b2 100644 --- a/hotdata/api/__init__.py +++ b/hotdata/api/__init__.py @@ -3,6 +3,7 @@ # import apis into api package from hotdata.api.connection_types_api import ConnectionTypesApi from hotdata.api.connections_api import ConnectionsApi +from hotdata.api.databases_api import DatabasesApi from hotdata.api.datasets_api import DatasetsApi from hotdata.api.embedding_providers_api import EmbeddingProvidersApi from hotdata.api.indexes_api import IndexesApi diff --git a/hotdata/api/connections_api.py b/hotdata/api/connections_api.py index 9bc7afe..dc04efa 100644 --- a/hotdata/api/connections_api.py +++ b/hotdata/api/connections_api.py @@ -647,6 +647,7 @@ def delete_connection( _response_types_map: Dict[str, Optional[str]] = { '204': None, '404': "ApiErrorResponse", + '409': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -715,6 +716,7 @@ def delete_connection_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '204': None, '404': "ApiErrorResponse", + '409': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -783,6 +785,7 @@ def delete_connection_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '204': None, '404': "ApiErrorResponse", + '409': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -2345,7 +2348,9 @@ def purge_connection_cache( _response_types_map: Dict[str, Optional[str]] = { '204': None, + '400': "ApiErrorResponse", '404': "ApiErrorResponse", + '409': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -2413,7 +2418,9 @@ def purge_connection_cache_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '204': None, + '400': "ApiErrorResponse", '404': "ApiErrorResponse", + '409': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -2481,7 +2488,9 @@ def purge_connection_cache_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '204': None, + '400': "ApiErrorResponse", '404': "ApiErrorResponse", + '409': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, diff --git a/hotdata/api/databases_api.py b/hotdata/api/databases_api.py new file mode 100644 index 0000000..1d25d42 --- /dev/null +++ b/hotdata/api/databases_api.py @@ -0,0 +1,1676 @@ +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from hotdata.models.attach_database_catalog_request import AttachDatabaseCatalogRequest +from hotdata.models.create_database_request import CreateDatabaseRequest +from hotdata.models.create_database_response import CreateDatabaseResponse +from hotdata.models.database_detail_response import DatabaseDetailResponse +from hotdata.models.list_databases_response import ListDatabasesResponse + +from hotdata.api_client import ApiClient, RequestSerialized +from hotdata.api_response import ApiResponse +from hotdata.rest import RESTResponseType + + +class DatabasesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def attach_database_catalog( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + attach_database_catalog_request: AttachDatabaseCatalogRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Attach catalog to database + + Attach an existing connection (catalog) to a database with an optional alias. Inside the database the catalog is reachable as the alias (when set) or its original name. + + :param database_id: Database ID (required) + :type database_id: str + :param attach_database_catalog_request: (required) + :type attach_database_catalog_request: AttachDatabaseCatalogRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._attach_database_catalog_serialize( + database_id=database_id, + attach_database_catalog_request=attach_database_catalog_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def attach_database_catalog_with_http_info( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + attach_database_catalog_request: AttachDatabaseCatalogRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Attach catalog to database + + Attach an existing connection (catalog) to a database with an optional alias. Inside the database the catalog is reachable as the alias (when set) or its original name. + + :param database_id: Database ID (required) + :type database_id: str + :param attach_database_catalog_request: (required) + :type attach_database_catalog_request: AttachDatabaseCatalogRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._attach_database_catalog_serialize( + database_id=database_id, + attach_database_catalog_request=attach_database_catalog_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def attach_database_catalog_without_preload_content( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + attach_database_catalog_request: AttachDatabaseCatalogRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Attach catalog to database + + Attach an existing connection (catalog) to a database with an optional alias. Inside the database the catalog is reachable as the alias (when set) or its original name. + + :param database_id: Database ID (required) + :type database_id: str + :param attach_database_catalog_request: (required) + :type attach_database_catalog_request: AttachDatabaseCatalogRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._attach_database_catalog_serialize( + database_id=database_id, + attach_database_catalog_request=attach_database_catalog_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _attach_database_catalog_serialize( + self, + database_id, + attach_database_catalog_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if database_id is not None: + _path_params['database_id'] = database_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if attach_database_catalog_request is not None: + _body_params = attach_database_catalog_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/databases/{database_id}/catalogs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_database( + self, + create_database_request: CreateDatabaseRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateDatabaseResponse: + """Create database + + Create a new database (a metadata-only grouping). A managed default catalog is auto-created and addressable inside the database as `default`. The optional `description` is a free-form display label and is not required to be unique. Optional `schemas` declares schemas/tables on the default catalog at create time; declared tables can be loaded via the standard managed-tables-load endpoint targeting `default_connection_id`. + + :param create_database_request: (required) + :type create_database_request: CreateDatabaseRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_database_serialize( + create_database_request=create_database_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateDatabaseResponse", + '400': "ApiErrorResponse", + '500': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_database_with_http_info( + self, + create_database_request: CreateDatabaseRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateDatabaseResponse]: + """Create database + + Create a new database (a metadata-only grouping). A managed default catalog is auto-created and addressable inside the database as `default`. The optional `description` is a free-form display label and is not required to be unique. Optional `schemas` declares schemas/tables on the default catalog at create time; declared tables can be loaded via the standard managed-tables-load endpoint targeting `default_connection_id`. + + :param create_database_request: (required) + :type create_database_request: CreateDatabaseRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_database_serialize( + create_database_request=create_database_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateDatabaseResponse", + '400': "ApiErrorResponse", + '500': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_database_without_preload_content( + self, + create_database_request: CreateDatabaseRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create database + + Create a new database (a metadata-only grouping). A managed default catalog is auto-created and addressable inside the database as `default`. The optional `description` is a free-form display label and is not required to be unique. Optional `schemas` declares schemas/tables on the default catalog at create time; declared tables can be loaded via the standard managed-tables-load endpoint targeting `default_connection_id`. + + :param create_database_request: (required) + :type create_database_request: CreateDatabaseRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_database_serialize( + create_database_request=create_database_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateDatabaseResponse", + '400': "ApiErrorResponse", + '500': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_database_serialize( + self, + create_database_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_database_request is not None: + _body_params = create_database_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/databases', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_database( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete database + + Delete a database and its auto-created default catalog. Attached catalogs are detached (their underlying connections are not deleted). + + :param database_id: Database ID (required) + :type database_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_database_serialize( + database_id=database_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_database_with_http_info( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete database + + Delete a database and its auto-created default catalog. Attached catalogs are detached (their underlying connections are not deleted). + + :param database_id: Database ID (required) + :type database_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_database_serialize( + database_id=database_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_database_without_preload_content( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete database + + Delete a database and its auto-created default catalog. Attached catalogs are detached (their underlying connections are not deleted). + + :param database_id: Database ID (required) + :type database_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_database_serialize( + database_id=database_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_database_serialize( + self, + database_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if database_id is not None: + _path_params['database_id'] = database_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/databases/{database_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def detach_database_catalog( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Detach catalog from database + + + :param database_id: Database ID (required) + :type database_id: str + :param connection_id: Connection ID (required) + :type connection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._detach_database_catalog_serialize( + database_id=database_id, + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def detach_database_catalog_with_http_info( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Detach catalog from database + + + :param database_id: Database ID (required) + :type database_id: str + :param connection_id: Connection ID (required) + :type connection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._detach_database_catalog_serialize( + database_id=database_id, + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def detach_database_catalog_without_preload_content( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Detach catalog from database + + + :param database_id: Database ID (required) + :type database_id: str + :param connection_id: Connection ID (required) + :type connection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._detach_database_catalog_serialize( + database_id=database_id, + connection_id=connection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _detach_database_catalog_serialize( + self, + database_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if database_id is not None: + _path_params['database_id'] = database_id + if connection_id is not None: + _path_params['connection_id'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/databases/{database_id}/catalogs/{connection_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_database( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DatabaseDetailResponse: + """Get database + + Fetch a database by id. The `description` field is a display label only; it is not accepted as an identifier here. + + :param database_id: Database ID (required) + :type database_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_database_serialize( + database_id=database_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DatabaseDetailResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_database_with_http_info( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DatabaseDetailResponse]: + """Get database + + Fetch a database by id. The `description` field is a display label only; it is not accepted as an identifier here. + + :param database_id: Database ID (required) + :type database_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_database_serialize( + database_id=database_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DatabaseDetailResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_database_without_preload_content( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get database + + Fetch a database by id. The `description` field is a display label only; it is not accepted as an identifier here. + + :param database_id: Database ID (required) + :type database_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_database_serialize( + database_id=database_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DatabaseDetailResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_database_serialize( + self, + database_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if database_id is not None: + _path_params['database_id'] = database_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/databases/{database_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_databases( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListDatabasesResponse: + """List databases + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_databases_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListDatabasesResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_databases_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListDatabasesResponse]: + """List databases + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_databases_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListDatabasesResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_databases_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List databases + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_databases_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListDatabasesResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_databases_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/databases', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/hotdata/api/query_api.py b/hotdata/api/query_api.py index d6f9c41..ad61416 100644 --- a/hotdata/api/query_api.py +++ b/hotdata/api/query_api.py @@ -16,6 +16,9 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from hotdata.models.query_request import QueryRequest from hotdata.models.query_response import QueryResponse @@ -41,6 +44,7 @@ def __init__(self, api_client=None) -> None: def query( self, query_request: QueryRequest, + x_database_id: Annotated[Optional[StrictStr], Field(description="Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -56,10 +60,12 @@ def query( ) -> QueryResponse: """Execute SQL query - Execute a SQL query against all registered connections and datasets. Use standard Postgres-compatible SQL to reference tables from any connection using the format `connection_name.schema.table`. Results are returned inline and a `result_id` is provided for later retrieval via the Results API. Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout. + Execute a SQL query against all registered connections and datasets. Use standard Postgres-compatible SQL to reference tables from any connection using the format `connection_name.schema.table`. Results are returned inline and a `result_id` is provided for later retrieval via the Results API. Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout. Set the `X-Database-Id` header to scope the query to a specific database. Inside a database scope the query only sees that database's auto `default` catalog plus any catalogs explicitly attached to it; workspace catalogs are invisible. :param query_request: (required) :type query_request: QueryRequest + :param x_database_id: Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404. + :type x_database_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -84,6 +90,7 @@ def query( _param = self._query_serialize( query_request=query_request, + x_database_id=x_database_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -94,6 +101,7 @@ def query( '200': "QueryResponse", '202': "AsyncQueryResponse", '400': "ApiErrorResponse", + '404': "ApiErrorResponse", '500': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -111,6 +119,7 @@ def query( def query_with_http_info( self, query_request: QueryRequest, + x_database_id: Annotated[Optional[StrictStr], Field(description="Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -126,10 +135,12 @@ def query_with_http_info( ) -> ApiResponse[QueryResponse]: """Execute SQL query - Execute a SQL query against all registered connections and datasets. Use standard Postgres-compatible SQL to reference tables from any connection using the format `connection_name.schema.table`. Results are returned inline and a `result_id` is provided for later retrieval via the Results API. Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout. + Execute a SQL query against all registered connections and datasets. Use standard Postgres-compatible SQL to reference tables from any connection using the format `connection_name.schema.table`. Results are returned inline and a `result_id` is provided for later retrieval via the Results API. Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout. Set the `X-Database-Id` header to scope the query to a specific database. Inside a database scope the query only sees that database's auto `default` catalog plus any catalogs explicitly attached to it; workspace catalogs are invisible. :param query_request: (required) :type query_request: QueryRequest + :param x_database_id: Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404. + :type x_database_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -154,6 +165,7 @@ def query_with_http_info( _param = self._query_serialize( query_request=query_request, + x_database_id=x_database_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -164,6 +176,7 @@ def query_with_http_info( '200': "QueryResponse", '202': "AsyncQueryResponse", '400': "ApiErrorResponse", + '404': "ApiErrorResponse", '500': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -181,6 +194,7 @@ def query_with_http_info( def query_without_preload_content( self, query_request: QueryRequest, + x_database_id: Annotated[Optional[StrictStr], Field(description="Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -196,10 +210,12 @@ def query_without_preload_content( ) -> RESTResponseType: """Execute SQL query - Execute a SQL query against all registered connections and datasets. Use standard Postgres-compatible SQL to reference tables from any connection using the format `connection_name.schema.table`. Results are returned inline and a `result_id` is provided for later retrieval via the Results API. Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout. + Execute a SQL query against all registered connections and datasets. Use standard Postgres-compatible SQL to reference tables from any connection using the format `connection_name.schema.table`. Results are returned inline and a `result_id` is provided for later retrieval via the Results API. Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout. Set the `X-Database-Id` header to scope the query to a specific database. Inside a database scope the query only sees that database's auto `default` catalog plus any catalogs explicitly attached to it; workspace catalogs are invisible. :param query_request: (required) :type query_request: QueryRequest + :param x_database_id: Scope the query to a specific database (its id). When set, only the database's attached catalogs are visible during planning. A malformed value is a 400; an unknown database id is a 404. + :type x_database_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -224,6 +240,7 @@ def query_without_preload_content( _param = self._query_serialize( query_request=query_request, + x_database_id=x_database_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -234,6 +251,7 @@ def query_without_preload_content( '200': "QueryResponse", '202': "AsyncQueryResponse", '400': "ApiErrorResponse", + '404': "ApiErrorResponse", '500': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -246,6 +264,7 @@ def query_without_preload_content( def _query_serialize( self, query_request, + x_database_id, _request_auth, _content_type, _headers, @@ -269,6 +288,8 @@ def _query_serialize( # process the path parameters # process the query parameters # process the header parameters + if x_database_id is not None: + _header_params['X-Database-Id'] = x_database_id # process the form parameters # process the body parameter if query_request is not None: diff --git a/hotdata/api_client.py b/hotdata/api_client.py index 2dfce87..33f8db9 100644 --- a/hotdata/api_client.py +++ b/hotdata/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/0.2.0/python' + self.user_agent = 'OpenAPI-Generator/0.2.2/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/hotdata/models/__init__.py b/hotdata/models/__init__.py index 90caa83..7bbb976 100644 --- a/hotdata/models/__init__.py +++ b/hotdata/models/__init__.py @@ -17,6 +17,7 @@ from hotdata.models.api_error_detail import ApiErrorDetail from hotdata.models.api_error_response import ApiErrorResponse from hotdata.models.async_query_response import AsyncQueryResponse +from hotdata.models.attach_database_catalog_request import AttachDatabaseCatalogRequest from hotdata.models.boolean_profile_detail import BooleanProfileDetail from hotdata.models.categorical_profile_detail import CategoricalProfileDetail from hotdata.models.category_value_info import CategoryValueInfo @@ -37,6 +38,8 @@ from hotdata.models.connection_type_summary import ConnectionTypeSummary from hotdata.models.create_connection_request import CreateConnectionRequest from hotdata.models.create_connection_response import CreateConnectionResponse +from hotdata.models.create_database_request import CreateDatabaseRequest +from hotdata.models.create_database_response import CreateDatabaseResponse from hotdata.models.create_dataset_request import CreateDatasetRequest from hotdata.models.create_dataset_response import CreateDatasetResponse from hotdata.models.create_embedding_provider_request import CreateEmbeddingProviderRequest @@ -48,6 +51,11 @@ from hotdata.models.create_secret_response import CreateSecretResponse from hotdata.models.create_workspace_request import CreateWorkspaceRequest from hotdata.models.create_workspace_response import CreateWorkspaceResponse +from hotdata.models.database_attachment_info import DatabaseAttachmentInfo +from hotdata.models.database_default_schema_decl import DatabaseDefaultSchemaDecl +from hotdata.models.database_default_table_decl import DatabaseDefaultTableDecl +from hotdata.models.database_detail_response import DatabaseDetailResponse +from hotdata.models.database_summary import DatabaseSummary from hotdata.models.dataset_source import DatasetSource from hotdata.models.dataset_source_one_of import DatasetSourceOneOf from hotdata.models.dataset_source_one_of1 import DatasetSourceOneOf1 @@ -77,6 +85,7 @@ from hotdata.models.job_type import JobType from hotdata.models.list_connection_types_response import ListConnectionTypesResponse from hotdata.models.list_connections_response import ListConnectionsResponse +from hotdata.models.list_databases_response import ListDatabasesResponse from hotdata.models.list_dataset_versions_response import ListDatasetVersionsResponse from hotdata.models.list_datasets_response import ListDatasetsResponse from hotdata.models.list_embedding_providers_response import ListEmbeddingProvidersResponse diff --git a/hotdata/models/attach_database_catalog_request.py b/hotdata/models/attach_database_catalog_request.py new file mode 100644 index 0000000..281a524 --- /dev/null +++ b/hotdata/models/attach_database_catalog_request.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AttachDatabaseCatalogRequest(BaseModel): + """ + Request body for POST /databases/{database_id}/catalogs + """ # noqa: E501 + alias: Optional[StrictStr] = Field(default=None, description="Optional alias under which this catalog is reachable inside the database. When omitted, it is reachable by the connection's name.") + connection_id: StrictStr + __properties: ClassVar[List[str]] = ["alias", "connection_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AttachDatabaseCatalogRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if alias (nullable) is None + # and model_fields_set contains the field + if self.alias is None and "alias" in self.model_fields_set: + _dict['alias'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AttachDatabaseCatalogRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "alias": obj.get("alias"), + "connection_id": obj.get("connection_id") + }) + return _obj + + diff --git a/hotdata/models/create_database_request.py b/hotdata/models/create_database_request.py new file mode 100644 index 0000000..65ab961 --- /dev/null +++ b/hotdata/models/create_database_request.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hotdata.models.database_default_schema_decl import DatabaseDefaultSchemaDecl +from typing import Optional, Set +from typing_extensions import Self + +class CreateDatabaseRequest(BaseModel): + """ + Request body for POST /databases + """ # noqa: E501 + description: Optional[StrictStr] = Field(default=None, description="Optional free-form display label (for UIs/CLIs). Not unique. Not an identifier — databases are always addressed by `id`.") + schemas: Optional[List[DatabaseDefaultSchemaDecl]] = Field(default=None, description="Optional schemas/tables to declare on the database's auto-created `default` catalog. Mirrors the `config.schemas` field of a managed `POST /v1/connections`. 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.") + __properties: ClassVar[List[str]] = ["description", "schemas"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateDatabaseRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in schemas (list) + _items = [] + if self.schemas: + for _item_schemas in self.schemas: + if _item_schemas: + _items.append(_item_schemas.to_dict()) + _dict['schemas'] = _items + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateDatabaseRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description"), + "schemas": [DatabaseDefaultSchemaDecl.from_dict(_item) for _item in obj["schemas"]] if obj.get("schemas") is not None else None + }) + return _obj + + diff --git a/hotdata/models/create_database_response.py b/hotdata/models/create_database_response.py new file mode 100644 index 0000000..5601ad4 --- /dev/null +++ b/hotdata/models/create_database_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CreateDatabaseResponse(BaseModel): + """ + Response body for POST /databases + """ # noqa: E501 + default_connection_id: StrictStr = Field(description="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.") + description: Optional[StrictStr] = None + id: StrictStr + __properties: ClassVar[List[str]] = ["default_connection_id", "description", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateDatabaseResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateDatabaseResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "default_connection_id": obj.get("default_connection_id"), + "description": obj.get("description"), + "id": obj.get("id") + }) + return _obj + + diff --git a/hotdata/models/database_attachment_info.py b/hotdata/models/database_attachment_info.py new file mode 100644 index 0000000..f53ce71 --- /dev/null +++ b/hotdata/models/database_attachment_info.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DatabaseAttachmentInfo(BaseModel): + """ + One attached catalog inside a database. + """ # noqa: E501 + alias: Optional[StrictStr] = Field(default=None, description="Alias under which this catalog is reachable inside the database. When `None`, the catalog is reachable by its original connection name.") + connection_id: StrictStr + __properties: ClassVar[List[str]] = ["alias", "connection_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DatabaseAttachmentInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if alias (nullable) is None + # and model_fields_set contains the field + if self.alias is None and "alias" in self.model_fields_set: + _dict['alias'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DatabaseAttachmentInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "alias": obj.get("alias"), + "connection_id": obj.get("connection_id") + }) + return _obj + + diff --git a/hotdata/models/database_default_schema_decl.py b/hotdata/models/database_default_schema_decl.py new file mode 100644 index 0000000..4d5f6f8 --- /dev/null +++ b/hotdata/models/database_default_schema_decl.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hotdata.models.database_default_table_decl import DatabaseDefaultTableDecl +from typing import Optional, Set +from typing_extensions import Self + +class DatabaseDefaultSchemaDecl(BaseModel): + """ + One schema declaration inside the database's default catalog at create time. Mirrors `crate::source::ManagedSchemaDecl`. Tables default to empty so callers can declare just a schema name and add tables later via the managed-tables API on the default connection. + """ # noqa: E501 + name: StrictStr + tables: Optional[List[DatabaseDefaultTableDecl]] = None + __properties: ClassVar[List[str]] = ["name", "tables"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DatabaseDefaultSchemaDecl from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in tables (list) + _items = [] + if self.tables: + for _item_tables in self.tables: + if _item_tables: + _items.append(_item_tables.to_dict()) + _dict['tables'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DatabaseDefaultSchemaDecl from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "tables": [DatabaseDefaultTableDecl.from_dict(_item) for _item in obj["tables"]] if obj.get("tables") is not None else None + }) + return _obj + + diff --git a/hotdata/models/database_default_table_decl.py b/hotdata/models/database_default_table_decl.py new file mode 100644 index 0000000..5742d9d --- /dev/null +++ b/hotdata/models/database_default_table_decl.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class DatabaseDefaultTableDecl(BaseModel): + """ + One table declaration inside a default-catalog schema at database-create time. Mirrors `crate::source::ManagedTableDecl` shape so the controller can convert with a simple `.map`. + """ # noqa: E501 + name: StrictStr + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DatabaseDefaultTableDecl from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DatabaseDefaultTableDecl from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + return _obj + + diff --git a/hotdata/models/database_detail_response.py b/hotdata/models/database_detail_response.py new file mode 100644 index 0000000..94a8419 --- /dev/null +++ b/hotdata/models/database_detail_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hotdata.models.database_attachment_info import DatabaseAttachmentInfo +from typing import Optional, Set +from typing_extensions import Self + +class DatabaseDetailResponse(BaseModel): + """ + Response body for GET /databases/{database_id} + """ # noqa: E501 + attachments: List[DatabaseAttachmentInfo] + default_connection_id: StrictStr + description: Optional[StrictStr] = None + id: StrictStr + __properties: ClassVar[List[str]] = ["attachments", "default_connection_id", "description", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DatabaseDetailResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DatabaseDetailResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "attachments": [DatabaseAttachmentInfo.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "default_connection_id": obj.get("default_connection_id"), + "description": obj.get("description"), + "id": obj.get("id") + }) + return _obj + + diff --git a/hotdata/models/database_summary.py b/hotdata/models/database_summary.py new file mode 100644 index 0000000..06b20bf --- /dev/null +++ b/hotdata/models/database_summary.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DatabaseSummary(BaseModel): + """ + Summary item in GET /databases + """ # noqa: E501 + description: Optional[StrictStr] = None + id: StrictStr + __properties: ClassVar[List[str]] = ["description", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DatabaseSummary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DatabaseSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description"), + "id": obj.get("id") + }) + return _obj + + diff --git a/hotdata/models/list_databases_response.py b/hotdata/models/list_databases_response.py new file mode 100644 index 0000000..4a3c8ca --- /dev/null +++ b/hotdata/models/list_databases_response.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from hotdata.models.database_summary import DatabaseSummary +from typing import Optional, Set +from typing_extensions import Self + +class ListDatabasesResponse(BaseModel): + """ + Response body for GET /databases + """ # noqa: E501 + databases: List[DatabaseSummary] + __properties: ClassVar[List[str]] = ["databases"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListDatabasesResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in databases (list) + _items = [] + if self.databases: + for _item_databases in self.databases: + if _item_databases: + _items.append(_item_databases.to_dict()) + _dict['databases'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListDatabasesResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "databases": [DatabaseSummary.from_dict(_item) for _item in obj["databases"]] if obj.get("databases") is not None else None + }) + return _obj + + diff --git a/test/test_attach_database_catalog_request.py b/test/test_attach_database_catalog_request.py new file mode 100644 index 0000000..1eca8ce --- /dev/null +++ b/test/test_attach_database_catalog_request.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.attach_database_catalog_request import AttachDatabaseCatalogRequest + +class TestAttachDatabaseCatalogRequest(unittest.TestCase): + """AttachDatabaseCatalogRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AttachDatabaseCatalogRequest: + """Test AttachDatabaseCatalogRequest + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `AttachDatabaseCatalogRequest` + """ + model = AttachDatabaseCatalogRequest() + if include_optional: + return AttachDatabaseCatalogRequest( + alias = '', + connection_id = '' + ) + else: + return AttachDatabaseCatalogRequest( + connection_id = '', + ) + """ + + def testAttachDatabaseCatalogRequest(self): + """Test AttachDatabaseCatalogRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_database_request.py b/test/test_create_database_request.py new file mode 100644 index 0000000..ba6e27f --- /dev/null +++ b/test/test_create_database_request.py @@ -0,0 +1,60 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.create_database_request import CreateDatabaseRequest + +class TestCreateDatabaseRequest(unittest.TestCase): + """CreateDatabaseRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateDatabaseRequest: + """Test CreateDatabaseRequest + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CreateDatabaseRequest` + """ + model = CreateDatabaseRequest() + if include_optional: + return CreateDatabaseRequest( + description = '', + schemas = [ + hotdata.models.database_default_schema_decl.DatabaseDefaultSchemaDecl( + name = '', + tables = [ + hotdata.models.database_default_table_decl.DatabaseDefaultTableDecl( + name = '', ) + ], ) + ] + ) + else: + return CreateDatabaseRequest( + ) + """ + + def testCreateDatabaseRequest(self): + """Test CreateDatabaseRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_database_response.py b/test/test_create_database_response.py new file mode 100644 index 0000000..f8c42c7 --- /dev/null +++ b/test/test_create_database_response.py @@ -0,0 +1,56 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.create_database_response import CreateDatabaseResponse + +class TestCreateDatabaseResponse(unittest.TestCase): + """CreateDatabaseResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateDatabaseResponse: + """Test CreateDatabaseResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CreateDatabaseResponse` + """ + model = CreateDatabaseResponse() + if include_optional: + return CreateDatabaseResponse( + default_connection_id = '', + description = '', + id = '' + ) + else: + return CreateDatabaseResponse( + default_connection_id = '', + id = '', + ) + """ + + def testCreateDatabaseResponse(self): + """Test CreateDatabaseResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_database_attachment_info.py b/test/test_database_attachment_info.py new file mode 100644 index 0000000..3927735 --- /dev/null +++ b/test/test_database_attachment_info.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.database_attachment_info import DatabaseAttachmentInfo + +class TestDatabaseAttachmentInfo(unittest.TestCase): + """DatabaseAttachmentInfo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatabaseAttachmentInfo: + """Test DatabaseAttachmentInfo + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DatabaseAttachmentInfo` + """ + model = DatabaseAttachmentInfo() + if include_optional: + return DatabaseAttachmentInfo( + alias = '', + connection_id = '' + ) + else: + return DatabaseAttachmentInfo( + connection_id = '', + ) + """ + + def testDatabaseAttachmentInfo(self): + """Test DatabaseAttachmentInfo""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_database_default_schema_decl.py b/test/test_database_default_schema_decl.py new file mode 100644 index 0000000..9c968f0 --- /dev/null +++ b/test/test_database_default_schema_decl.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.database_default_schema_decl import DatabaseDefaultSchemaDecl + +class TestDatabaseDefaultSchemaDecl(unittest.TestCase): + """DatabaseDefaultSchemaDecl unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatabaseDefaultSchemaDecl: + """Test DatabaseDefaultSchemaDecl + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DatabaseDefaultSchemaDecl` + """ + model = DatabaseDefaultSchemaDecl() + if include_optional: + return DatabaseDefaultSchemaDecl( + name = '', + tables = [ + hotdata.models.database_default_table_decl.DatabaseDefaultTableDecl( + name = '', ) + ] + ) + else: + return DatabaseDefaultSchemaDecl( + name = '', + ) + """ + + def testDatabaseDefaultSchemaDecl(self): + """Test DatabaseDefaultSchemaDecl""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_database_default_table_decl.py b/test/test_database_default_table_decl.py new file mode 100644 index 0000000..5e071c4 --- /dev/null +++ b/test/test_database_default_table_decl.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.database_default_table_decl import DatabaseDefaultTableDecl + +class TestDatabaseDefaultTableDecl(unittest.TestCase): + """DatabaseDefaultTableDecl unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatabaseDefaultTableDecl: + """Test DatabaseDefaultTableDecl + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DatabaseDefaultTableDecl` + """ + model = DatabaseDefaultTableDecl() + if include_optional: + return DatabaseDefaultTableDecl( + name = '' + ) + else: + return DatabaseDefaultTableDecl( + name = '', + ) + """ + + def testDatabaseDefaultTableDecl(self): + """Test DatabaseDefaultTableDecl""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_database_detail_response.py b/test/test_database_detail_response.py new file mode 100644 index 0000000..a503538 --- /dev/null +++ b/test/test_database_detail_response.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.database_detail_response import DatabaseDetailResponse + +class TestDatabaseDetailResponse(unittest.TestCase): + """DatabaseDetailResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatabaseDetailResponse: + """Test DatabaseDetailResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DatabaseDetailResponse` + """ + model = DatabaseDetailResponse() + if include_optional: + return DatabaseDetailResponse( + attachments = [ + hotdata.models.database_attachment_info.DatabaseAttachmentInfo( + alias = '', + connection_id = '', ) + ], + default_connection_id = '', + description = '', + id = '' + ) + else: + return DatabaseDetailResponse( + attachments = [ + hotdata.models.database_attachment_info.DatabaseAttachmentInfo( + alias = '', + connection_id = '', ) + ], + default_connection_id = '', + id = '', + ) + """ + + def testDatabaseDetailResponse(self): + """Test DatabaseDetailResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_database_summary.py b/test/test_database_summary.py new file mode 100644 index 0000000..8e5eaea --- /dev/null +++ b/test/test_database_summary.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.database_summary import DatabaseSummary + +class TestDatabaseSummary(unittest.TestCase): + """DatabaseSummary unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatabaseSummary: + """Test DatabaseSummary + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DatabaseSummary` + """ + model = DatabaseSummary() + if include_optional: + return DatabaseSummary( + description = '', + id = '' + ) + else: + return DatabaseSummary( + id = '', + ) + """ + + def testDatabaseSummary(self): + """Test DatabaseSummary""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_databases_api.py b/test/test_databases_api.py new file mode 100644 index 0000000..6a2c55e --- /dev/null +++ b/test/test_databases_api.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.api.databases_api import DatabasesApi + + +class TestDatabasesApi(unittest.TestCase): + """DatabasesApi unit test stubs""" + + def setUp(self) -> None: + self.api = DatabasesApi() + + def tearDown(self) -> None: + pass + + def test_attach_database_catalog(self) -> None: + """Test case for attach_database_catalog + + Attach catalog to database + """ + pass + + def test_create_database(self) -> None: + """Test case for create_database + + Create database + """ + pass + + def test_delete_database(self) -> None: + """Test case for delete_database + + Delete database + """ + pass + + def test_detach_database_catalog(self) -> None: + """Test case for detach_database_catalog + + Detach catalog from database + """ + pass + + def test_get_database(self) -> None: + """Test case for get_database + + Get database + """ + pass + + def test_list_databases(self) -> None: + """Test case for list_databases + + List databases + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_list_databases_response.py b/test/test_list_databases_response.py new file mode 100644 index 0000000..b7ff80e --- /dev/null +++ b/test/test_list_databases_response.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.list_databases_response import ListDatabasesResponse + +class TestListDatabasesResponse(unittest.TestCase): + """ListDatabasesResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ListDatabasesResponse: + """Test ListDatabasesResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ListDatabasesResponse` + """ + model = ListDatabasesResponse() + if include_optional: + return ListDatabasesResponse( + databases = [ + hotdata.models.database_summary.DatabaseSummary( + description = '', + id = '', ) + ] + ) + else: + return ListDatabasesResponse( + databases = [ + hotdata.models.database_summary.DatabaseSummary( + description = '', + id = '', ) + ], + ) + """ + + def testListDatabasesResponse(self): + """Test ListDatabasesResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()