From feeaf218e12f38b239fb56cdcdfc2e79c1f2eda5 Mon Sep 17 00:00:00 2001 From: "hotdata-automation[bot]" <267177015+hotdata-automation[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2026 20:00:39 +0000 Subject: [PATCH] chore: regenerate client from updated OpenAPI spec --- .openapi-generator/FILES | 15 + docs/AddManagedSchemaRequest.md | 31 + docs/AddManagedTableDecl.md | 30 + docs/AddManagedTableRequest.md | 30 + docs/ConnectionsApi.md | 186 ++++++ docs/DatabasesApi.md | 186 ++++++ docs/ManagedSchemaResponse.md | 32 + docs/ManagedTableResponse.md | 32 + hotdata/__init__.py | 10 + hotdata/api/connections_api.py | 617 +++++++++++++++++++ hotdata/api/databases_api.py | 617 +++++++++++++++++++ hotdata/models/__init__.py | 5 + hotdata/models/add_managed_schema_request.py | 98 +++ hotdata/models/add_managed_table_decl.py | 88 +++ hotdata/models/add_managed_table_request.py | 88 +++ hotdata/models/managed_schema_response.py | 92 +++ hotdata/models/managed_table_response.py | 92 +++ test/test_add_managed_schema_request.py | 57 ++ test/test_add_managed_table_decl.py | 53 ++ test/test_add_managed_table_request.py | 53 ++ test/test_managed_schema_response.py | 61 ++ test/test_managed_table_response.py | 57 ++ 22 files changed, 2530 insertions(+) create mode 100644 docs/AddManagedSchemaRequest.md create mode 100644 docs/AddManagedTableDecl.md create mode 100644 docs/AddManagedTableRequest.md create mode 100644 docs/ManagedSchemaResponse.md create mode 100644 docs/ManagedTableResponse.md create mode 100644 hotdata/models/add_managed_schema_request.py create mode 100644 hotdata/models/add_managed_table_decl.py create mode 100644 hotdata/models/add_managed_table_request.py create mode 100644 hotdata/models/managed_schema_response.py create mode 100644 hotdata/models/managed_table_response.py create mode 100644 test/test_add_managed_schema_request.py create mode 100644 test/test_add_managed_table_decl.py create mode 100644 test/test_add_managed_table_request.py create mode 100644 test/test_managed_schema_response.py create mode 100644 test/test_managed_table_response.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3686dda..eecb7ba 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,6 +1,9 @@ .github/workflows/python.yml .gitignore .gitlab-ci.yml +docs/AddManagedSchemaRequest.md +docs/AddManagedTableDecl.md +docs/AddManagedTableRequest.md docs/ApiErrorDetail.md docs/ApiErrorResponse.md docs/AsyncQueryResponse.md @@ -99,6 +102,8 @@ docs/ListUploadsResponse.md docs/ListWorkspacesResponse.md docs/LoadManagedTableRequest.md docs/LoadManagedTableResponse.md +docs/ManagedSchemaResponse.md +docs/ManagedTableResponse.md docs/NumericProfileDetail.md docs/QueryApi.md docs/QueryRequest.md @@ -175,6 +180,9 @@ hotdata/api_response.py hotdata/configuration.py hotdata/exceptions.py hotdata/models/__init__.py +hotdata/models/add_managed_schema_request.py +hotdata/models/add_managed_table_decl.py +hotdata/models/add_managed_table_request.py hotdata/models/api_error_detail.py hotdata/models/api_error_response.py hotdata/models/async_query_response.py @@ -264,6 +272,8 @@ hotdata/models/list_uploads_response.py hotdata/models/list_workspaces_response.py hotdata/models/load_managed_table_request.py hotdata/models/load_managed_table_response.py +hotdata/models/managed_schema_response.py +hotdata/models/managed_table_response.py hotdata/models/numeric_profile_detail.py hotdata/models/query_request.py hotdata/models/query_response.py @@ -313,4 +323,9 @@ requirements.txt setup.cfg test-requirements.txt test/__init__.py +test/test_add_managed_schema_request.py +test/test_add_managed_table_decl.py +test/test_add_managed_table_request.py +test/test_managed_schema_response.py +test/test_managed_table_response.py tox.ini diff --git a/docs/AddManagedSchemaRequest.md b/docs/AddManagedSchemaRequest.md new file mode 100644 index 0000000..47a2b34 --- /dev/null +++ b/docs/AddManagedSchemaRequest.md @@ -0,0 +1,31 @@ +# AddManagedSchemaRequest + +Request body for adding a schema to an existing managed catalog: `POST /v1/connections/{id}/schemas` and `POST /v1/databases/{id}/schemas`. `tables` is optional — omit it to declare an empty schema and add tables later. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**tables** | [**List[AddManagedTableDecl]**](AddManagedTableDecl.md) | | [optional] + +## Example + +```python +from hotdata.models.add_managed_schema_request import AddManagedSchemaRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of AddManagedSchemaRequest from a JSON string +add_managed_schema_request_instance = AddManagedSchemaRequest.from_json(json) +# print the JSON string representation of the object +print(AddManagedSchemaRequest.to_json()) + +# convert the object into a dict +add_managed_schema_request_dict = add_managed_schema_request_instance.to_dict() +# create an instance of AddManagedSchemaRequest from a dict +add_managed_schema_request_from_dict = AddManagedSchemaRequest.from_dict(add_managed_schema_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/AddManagedTableDecl.md b/docs/AddManagedTableDecl.md new file mode 100644 index 0000000..1fb68f1 --- /dev/null +++ b/docs/AddManagedTableDecl.md @@ -0,0 +1,30 @@ +# AddManagedTableDecl + +One table declaration inside an add-schema request body. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | + +## Example + +```python +from hotdata.models.add_managed_table_decl import AddManagedTableDecl + +# TODO update the JSON string below +json = "{}" +# create an instance of AddManagedTableDecl from a JSON string +add_managed_table_decl_instance = AddManagedTableDecl.from_json(json) +# print the JSON string representation of the object +print(AddManagedTableDecl.to_json()) + +# convert the object into a dict +add_managed_table_decl_dict = add_managed_table_decl_instance.to_dict() +# create an instance of AddManagedTableDecl from a dict +add_managed_table_decl_from_dict = AddManagedTableDecl.from_dict(add_managed_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/AddManagedTableRequest.md b/docs/AddManagedTableRequest.md new file mode 100644 index 0000000..f4f8f64 --- /dev/null +++ b/docs/AddManagedTableRequest.md @@ -0,0 +1,30 @@ +# AddManagedTableRequest + +Request body for adding a table to an existing schema: `POST /v1/connections/{id}/schemas/{schema}/tables` and `POST /v1/databases/{id}/schemas/{schema}/tables`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | + +## Example + +```python +from hotdata.models.add_managed_table_request import AddManagedTableRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of AddManagedTableRequest from a JSON string +add_managed_table_request_instance = AddManagedTableRequest.from_json(json) +# print the JSON string representation of the object +print(AddManagedTableRequest.to_json()) + +# convert the object into a dict +add_managed_table_request_dict = add_managed_table_request_instance.to_dict() +# create an instance of AddManagedTableRequest from a dict +add_managed_table_request_from_dict = AddManagedTableRequest.from_dict(add_managed_table_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 0f98f18..75c2d18 100644 --- a/docs/ConnectionsApi.md +++ b/docs/ConnectionsApi.md @@ -4,6 +4,8 @@ All URIs are relative to *https://api.hotdata.dev* Method | HTTP request | Description ------------- | ------------- | ------------- +[**add_managed_schema**](ConnectionsApi.md#add_managed_schema) | **POST** /v1/connections/{connection_id}/schemas | Add managed schema +[**add_managed_table**](ConnectionsApi.md#add_managed_table) | **POST** /v1/connections/{connection_id}/schemas/{schema}/tables | Add managed table [**check_connection_health**](ConnectionsApi.md#check_connection_health) | **GET** /v1/connections/{connection_id}/health | Check connection health [**create_connection**](ConnectionsApi.md#create_connection) | **POST** /v1/connections | Create connection [**delete_connection**](ConnectionsApi.md#delete_connection) | **DELETE** /v1/connections/{connection_id} | Delete connection @@ -16,6 +18,190 @@ Method | HTTP request | Description [**purge_table_cache**](ConnectionsApi.md#purge_table_cache) | **DELETE** /v1/connections/{connection_id}/tables/{schema}/{table}/cache | Purge table cache +# **add_managed_schema** +> ManagedSchemaResponse add_managed_schema(connection_id, add_managed_schema_request) + +Add managed schema + +Declare a new schema (and optionally its tables) on an existing managed catalog after creation. The schema is added to the connection's declaration; declared tables can then be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.add_managed_schema_request import AddManagedSchemaRequest +from hotdata.models.managed_schema_response import ManagedSchemaResponse +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.ConnectionsApi(api_client) + connection_id = 'connection_id_example' # str | Connection ID + add_managed_schema_request = hotdata.AddManagedSchemaRequest() # AddManagedSchemaRequest | + + try: + # Add managed schema + api_response = api_instance.add_managed_schema(connection_id, add_managed_schema_request) + print("The response of ConnectionsApi->add_managed_schema:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ConnectionsApi->add_managed_schema: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **connection_id** | **str**| Connection ID | + **add_managed_schema_request** | [**AddManagedSchemaRequest**](AddManagedSchemaRequest.md)| | + +### Return type + +[**ManagedSchemaResponse**](ManagedSchemaResponse.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** | Schema added | - | +**400** | Connection is not a managed catalog or identifier is invalid | - | +**404** | Connection not found | - | +**409** | Schema already exists | - | + +[[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) + +# **add_managed_table** +> ManagedTableResponse add_managed_table(connection_id, var_schema, add_managed_table_request) + +Add managed table + +Declare a new table on an existing schema of a managed catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.add_managed_table_request import AddManagedTableRequest +from hotdata.models.managed_table_response import ManagedTableResponse +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.ConnectionsApi(api_client) + connection_id = 'connection_id_example' # str | Connection ID + var_schema = 'var_schema_example' # str | Schema name + add_managed_table_request = hotdata.AddManagedTableRequest() # AddManagedTableRequest | + + try: + # Add managed table + api_response = api_instance.add_managed_table(connection_id, var_schema, add_managed_table_request) + print("The response of ConnectionsApi->add_managed_table:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ConnectionsApi->add_managed_table: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **connection_id** | **str**| Connection ID | + **var_schema** | **str**| Schema name | + **add_managed_table_request** | [**AddManagedTableRequest**](AddManagedTableRequest.md)| | + +### Return type + +[**ManagedTableResponse**](ManagedTableResponse.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** | Table added | - | +**400** | Connection is not a managed catalog or identifier is invalid | - | +**404** | Connection or schema not found | - | +**409** | Table already exists | - | + +[[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) + # **check_connection_health** > ConnectionHealthResponse check_connection_health(connection_id) diff --git a/docs/DatabasesApi.md b/docs/DatabasesApi.md index d108cfc..d15dca2 100644 --- a/docs/DatabasesApi.md +++ b/docs/DatabasesApi.md @@ -4,6 +4,8 @@ All URIs are relative to *https://api.hotdata.dev* Method | HTTP request | Description ------------- | ------------- | ------------- +[**add_database_schema**](DatabasesApi.md#add_database_schema) | **POST** /v1/databases/{database_id}/schemas | Add schema to database default catalog +[**add_database_table**](DatabasesApi.md#add_database_table) | **POST** /v1/databases/{database_id}/schemas/{schema}/tables | Add table to database default catalog [**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 @@ -12,6 +14,190 @@ Method | HTTP request | Description [**list_databases**](DatabasesApi.md#list_databases) | **GET** /v1/databases | List databases +# **add_database_schema** +> ManagedSchemaResponse add_database_schema(database_id, add_managed_schema_request) + +Add schema to database default catalog + +Declare a new schema (and optionally its tables) on the database's auto-created default catalog after creation. The schema becomes reachable inside the database scope (e.g. `default..` and `information_schema.schemata`) without the caller addressing the internal default connection directly. Identifiers are normalised to lowercase. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.add_managed_schema_request import AddManagedSchemaRequest +from hotdata.models.managed_schema_response import ManagedSchemaResponse +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 + add_managed_schema_request = hotdata.AddManagedSchemaRequest() # AddManagedSchemaRequest | + + try: + # Add schema to database default catalog + api_response = api_instance.add_database_schema(database_id, add_managed_schema_request) + print("The response of DatabasesApi->add_database_schema:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DatabasesApi->add_database_schema: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **database_id** | **str**| Database ID | + **add_managed_schema_request** | [**AddManagedSchemaRequest**](AddManagedSchemaRequest.md)| | + +### Return type + +[**ManagedSchemaResponse**](ManagedSchemaResponse.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** | Schema added | - | +**400** | Invalid identifier | - | +**404** | Database not found | - | +**409** | Schema already exists | - | + +[[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) + +# **add_database_table** +> ManagedTableResponse add_database_table(database_id, var_schema, add_managed_table_request) + +Add table to database default catalog + +Declare a new table on an existing schema of the database's default catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint targeting the default connection. Identifiers are normalised to lowercase. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.add_managed_table_request import AddManagedTableRequest +from hotdata.models.managed_table_response import ManagedTableResponse +from hotdata.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.hotdata.dev +# See configuration.py for a list of all supported configuration parameters. +configuration = hotdata.Configuration( + host = "https://api.hotdata.dev" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: WorkspaceId +configuration.api_key['WorkspaceId'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['WorkspaceId'] = 'Bearer' + +# Configure Bearer authorization: BearerAuth +configuration = hotdata.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with hotdata.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hotdata.DatabasesApi(api_client) + database_id = 'database_id_example' # str | Database ID + var_schema = 'var_schema_example' # str | Schema name + add_managed_table_request = hotdata.AddManagedTableRequest() # AddManagedTableRequest | + + try: + # Add table to database default catalog + api_response = api_instance.add_database_table(database_id, var_schema, add_managed_table_request) + print("The response of DatabasesApi->add_database_table:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DatabasesApi->add_database_table: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **database_id** | **str**| Database ID | + **var_schema** | **str**| Schema name | + **add_managed_table_request** | [**AddManagedTableRequest**](AddManagedTableRequest.md)| | + +### Return type + +[**ManagedTableResponse**](ManagedTableResponse.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** | Table added | - | +**400** | Invalid identifier | - | +**404** | Database or schema not found | - | +**409** | Table already exists | - | + +[[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) + # **attach_database_catalog** > attach_database_catalog(database_id, attach_database_catalog_request) diff --git a/docs/ManagedSchemaResponse.md b/docs/ManagedSchemaResponse.md new file mode 100644 index 0000000..8f9194a --- /dev/null +++ b/docs/ManagedSchemaResponse.md @@ -0,0 +1,32 @@ +# ManagedSchemaResponse + +Response body for a successful add-schema request. Echoes the normalised (lowercased) names so callers see exactly what was persisted. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**connection_id** | **str** | Connection backing the catalog the schema was added to. For a database default catalog this is the database's `default_connection_id`. | +**var_schema** | **str** | | +**tables** | **List[str]** | | + +## Example + +```python +from hotdata.models.managed_schema_response import ManagedSchemaResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ManagedSchemaResponse from a JSON string +managed_schema_response_instance = ManagedSchemaResponse.from_json(json) +# print the JSON string representation of the object +print(ManagedSchemaResponse.to_json()) + +# convert the object into a dict +managed_schema_response_dict = managed_schema_response_instance.to_dict() +# create an instance of ManagedSchemaResponse from a dict +managed_schema_response_from_dict = ManagedSchemaResponse.from_dict(managed_schema_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/ManagedTableResponse.md b/docs/ManagedTableResponse.md new file mode 100644 index 0000000..4e4a062 --- /dev/null +++ b/docs/ManagedTableResponse.md @@ -0,0 +1,32 @@ +# ManagedTableResponse + +Response body for a successful add-table request. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**connection_id** | **str** | | +**var_schema** | **str** | | +**table** | **str** | | + +## Example + +```python +from hotdata.models.managed_table_response import ManagedTableResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ManagedTableResponse from a JSON string +managed_table_response_instance = ManagedTableResponse.from_json(json) +# print the JSON string representation of the object +print(ManagedTableResponse.to_json()) + +# convert the object into a dict +managed_table_response_dict = managed_table_response_instance.to_dict() +# create an instance of ManagedTableResponse from a dict +managed_table_response_from_dict = ManagedTableResponse.from_dict(managed_table_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/hotdata/__init__.py b/hotdata/__init__.py index e53be7a..c0733b7 100644 --- a/hotdata/__init__.py +++ b/hotdata/__init__.py @@ -51,6 +51,9 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "AddManagedSchemaRequest", + "AddManagedTableDecl", + "AddManagedTableRequest", "ApiErrorDetail", "ApiErrorResponse", "AsyncQueryResponse", @@ -140,6 +143,8 @@ "ListWorkspacesResponse", "LoadManagedTableRequest", "LoadManagedTableResponse", + "ManagedSchemaResponse", + "ManagedTableResponse", "NumericProfileDetail", "QueryRequest", "QueryResponse", @@ -216,6 +221,9 @@ from hotdata.exceptions import ApiException as ApiException # import models into sdk package +from hotdata.models.add_managed_schema_request import AddManagedSchemaRequest as AddManagedSchemaRequest +from hotdata.models.add_managed_table_decl import AddManagedTableDecl as AddManagedTableDecl +from hotdata.models.add_managed_table_request import AddManagedTableRequest as AddManagedTableRequest 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 @@ -305,6 +313,8 @@ from hotdata.models.list_workspaces_response import ListWorkspacesResponse as ListWorkspacesResponse from hotdata.models.load_managed_table_request import LoadManagedTableRequest as LoadManagedTableRequest from hotdata.models.load_managed_table_response import LoadManagedTableResponse as LoadManagedTableResponse +from hotdata.models.managed_schema_response import ManagedSchemaResponse as ManagedSchemaResponse +from hotdata.models.managed_table_response import ManagedTableResponse as ManagedTableResponse from hotdata.models.numeric_profile_detail import NumericProfileDetail as NumericProfileDetail from hotdata.models.query_request import QueryRequest as QueryRequest from hotdata.models.query_response import QueryResponse as QueryResponse diff --git a/hotdata/api/connections_api.py b/hotdata/api/connections_api.py index dc04efa..5d8b30a 100644 --- a/hotdata/api/connections_api.py +++ b/hotdata/api/connections_api.py @@ -18,6 +18,8 @@ from pydantic import Field, StrictStr from typing_extensions import Annotated +from hotdata.models.add_managed_schema_request import AddManagedSchemaRequest +from hotdata.models.add_managed_table_request import AddManagedTableRequest from hotdata.models.connection_health_response import ConnectionHealthResponse from hotdata.models.create_connection_request import CreateConnectionRequest from hotdata.models.create_connection_response import CreateConnectionResponse @@ -25,6 +27,8 @@ from hotdata.models.list_connections_response import ListConnectionsResponse from hotdata.models.load_managed_table_request import LoadManagedTableRequest from hotdata.models.load_managed_table_response import LoadManagedTableResponse +from hotdata.models.managed_schema_response import ManagedSchemaResponse +from hotdata.models.managed_table_response import ManagedTableResponse from hotdata.models.table_profile_response import TableProfileResponse from hotdata.api_client import ApiClient, RequestSerialized @@ -45,6 +49,619 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + def add_managed_schema( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + add_managed_schema_request: AddManagedSchemaRequest, + _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, + ) -> ManagedSchemaResponse: + """Add managed schema + + Declare a new schema (and optionally its tables) on an existing managed catalog after creation. The schema is added to the connection's declaration; declared tables can then be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param add_managed_schema_request: (required) + :type add_managed_schema_request: AddManagedSchemaRequest + :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._add_managed_schema_serialize( + connection_id=connection_id, + add_managed_schema_request=add_managed_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedSchemaResponse", + '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 add_managed_schema_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + add_managed_schema_request: AddManagedSchemaRequest, + _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[ManagedSchemaResponse]: + """Add managed schema + + Declare a new schema (and optionally its tables) on an existing managed catalog after creation. The schema is added to the connection's declaration; declared tables can then be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param add_managed_schema_request: (required) + :type add_managed_schema_request: AddManagedSchemaRequest + :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._add_managed_schema_serialize( + connection_id=connection_id, + add_managed_schema_request=add_managed_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedSchemaResponse", + '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 add_managed_schema_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + add_managed_schema_request: AddManagedSchemaRequest, + _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: + """Add managed schema + + Declare a new schema (and optionally its tables) on an existing managed catalog after creation. The schema is added to the connection's declaration; declared tables can then be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param add_managed_schema_request: (required) + :type add_managed_schema_request: AddManagedSchemaRequest + :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._add_managed_schema_serialize( + connection_id=connection_id, + add_managed_schema_request=add_managed_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedSchemaResponse", + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_managed_schema_serialize( + self, + connection_id, + add_managed_schema_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 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 + if add_managed_schema_request is not None: + _body_params = add_managed_schema_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/connections/{connection_id}/schemas', + 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 add_managed_table( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + add_managed_table_request: AddManagedTableRequest, + _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, + ) -> ManagedTableResponse: + """Add managed table + + Declare a new table on an existing schema of a managed catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param add_managed_table_request: (required) + :type add_managed_table_request: AddManagedTableRequest + :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._add_managed_table_serialize( + connection_id=connection_id, + var_schema=var_schema, + add_managed_table_request=add_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedTableResponse", + '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 add_managed_table_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + add_managed_table_request: AddManagedTableRequest, + _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[ManagedTableResponse]: + """Add managed table + + Declare a new table on an existing schema of a managed catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param add_managed_table_request: (required) + :type add_managed_table_request: AddManagedTableRequest + :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._add_managed_table_serialize( + connection_id=connection_id, + var_schema=var_schema, + add_managed_table_request=add_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedTableResponse", + '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 add_managed_table_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + add_managed_table_request: AddManagedTableRequest, + _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: + """Add managed table + + Declare a new table on an existing schema of a managed catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint. Only valid against connections whose source type is `managed`. Identifiers are normalised to lowercase. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param add_managed_table_request: (required) + :type add_managed_table_request: AddManagedTableRequest + :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._add_managed_table_serialize( + connection_id=connection_id, + var_schema=var_schema, + add_managed_table_request=add_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedTableResponse", + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_managed_table_serialize( + self, + connection_id, + var_schema, + add_managed_table_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 connection_id is not None: + _path_params['connection_id'] = connection_id + if var_schema is not None: + _path_params['schema'] = var_schema + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if add_managed_table_request is not None: + _body_params = add_managed_table_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/connections/{connection_id}/schemas/{schema}/tables', + 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 check_connection_health( self, diff --git a/hotdata/api/databases_api.py b/hotdata/api/databases_api.py index 02726d6..4dacdef 100644 --- a/hotdata/api/databases_api.py +++ b/hotdata/api/databases_api.py @@ -18,11 +18,15 @@ from pydantic import Field, StrictStr from typing_extensions import Annotated +from hotdata.models.add_managed_schema_request import AddManagedSchemaRequest +from hotdata.models.add_managed_table_request import AddManagedTableRequest 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.models.managed_schema_response import ManagedSchemaResponse +from hotdata.models.managed_table_response import ManagedTableResponse from hotdata.api_client import ApiClient, RequestSerialized from hotdata.api_response import ApiResponse @@ -42,6 +46,619 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + def add_database_schema( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + add_managed_schema_request: AddManagedSchemaRequest, + _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, + ) -> ManagedSchemaResponse: + """Add schema to database default catalog + + Declare a new schema (and optionally its tables) on the database's auto-created default catalog after creation. The schema becomes reachable inside the database scope (e.g. `default..
` and `information_schema.schemata`) without the caller addressing the internal default connection directly. Identifiers are normalised to lowercase. + + :param database_id: Database ID (required) + :type database_id: str + :param add_managed_schema_request: (required) + :type add_managed_schema_request: AddManagedSchemaRequest + :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._add_database_schema_serialize( + database_id=database_id, + add_managed_schema_request=add_managed_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedSchemaResponse", + '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 add_database_schema_with_http_info( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + add_managed_schema_request: AddManagedSchemaRequest, + _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[ManagedSchemaResponse]: + """Add schema to database default catalog + + Declare a new schema (and optionally its tables) on the database's auto-created default catalog after creation. The schema becomes reachable inside the database scope (e.g. `default..
` and `information_schema.schemata`) without the caller addressing the internal default connection directly. Identifiers are normalised to lowercase. + + :param database_id: Database ID (required) + :type database_id: str + :param add_managed_schema_request: (required) + :type add_managed_schema_request: AddManagedSchemaRequest + :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._add_database_schema_serialize( + database_id=database_id, + add_managed_schema_request=add_managed_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedSchemaResponse", + '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 add_database_schema_without_preload_content( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + add_managed_schema_request: AddManagedSchemaRequest, + _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: + """Add schema to database default catalog + + Declare a new schema (and optionally its tables) on the database's auto-created default catalog after creation. The schema becomes reachable inside the database scope (e.g. `default..
` and `information_schema.schemata`) without the caller addressing the internal default connection directly. Identifiers are normalised to lowercase. + + :param database_id: Database ID (required) + :type database_id: str + :param add_managed_schema_request: (required) + :type add_managed_schema_request: AddManagedSchemaRequest + :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._add_database_schema_serialize( + database_id=database_id, + add_managed_schema_request=add_managed_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedSchemaResponse", + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_database_schema_serialize( + self, + database_id, + add_managed_schema_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 add_managed_schema_request is not None: + _body_params = add_managed_schema_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}/schemas', + 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 add_database_table( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + add_managed_table_request: AddManagedTableRequest, + _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, + ) -> ManagedTableResponse: + """Add table to database default catalog + + Declare a new table on an existing schema of the database's default catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint targeting the default connection. Identifiers are normalised to lowercase. + + :param database_id: Database ID (required) + :type database_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param add_managed_table_request: (required) + :type add_managed_table_request: AddManagedTableRequest + :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._add_database_table_serialize( + database_id=database_id, + var_schema=var_schema, + add_managed_table_request=add_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedTableResponse", + '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 add_database_table_with_http_info( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + add_managed_table_request: AddManagedTableRequest, + _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[ManagedTableResponse]: + """Add table to database default catalog + + Declare a new table on an existing schema of the database's default catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint targeting the default connection. Identifiers are normalised to lowercase. + + :param database_id: Database ID (required) + :type database_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param add_managed_table_request: (required) + :type add_managed_table_request: AddManagedTableRequest + :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._add_database_table_serialize( + database_id=database_id, + var_schema=var_schema, + add_managed_table_request=add_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedTableResponse", + '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 add_database_table_without_preload_content( + self, + database_id: Annotated[StrictStr, Field(description="Database ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + add_managed_table_request: AddManagedTableRequest, + _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: + """Add table to database default catalog + + Declare a new table on an existing schema of the database's default catalog after creation. The table is added empty (declared-but-unloaded) and can be populated via the managed-table load endpoint targeting the default connection. Identifiers are normalised to lowercase. + + :param database_id: Database ID (required) + :type database_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param add_managed_table_request: (required) + :type add_managed_table_request: AddManagedTableRequest + :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._add_database_table_serialize( + database_id=database_id, + var_schema=var_schema, + add_managed_table_request=add_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ManagedTableResponse", + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_database_table_serialize( + self, + database_id, + var_schema, + add_managed_table_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 + if var_schema is not None: + _path_params['schema'] = var_schema + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if add_managed_table_request is not None: + _body_params = add_managed_table_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}/schemas/{schema}/tables', + 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 attach_database_catalog( self, diff --git a/hotdata/models/__init__.py b/hotdata/models/__init__.py index 58f1201..5883742 100644 --- a/hotdata/models/__init__.py +++ b/hotdata/models/__init__.py @@ -14,6 +14,9 @@ """ # noqa: E501 # import models into model package +from hotdata.models.add_managed_schema_request import AddManagedSchemaRequest +from hotdata.models.add_managed_table_decl import AddManagedTableDecl +from hotdata.models.add_managed_table_request import AddManagedTableRequest from hotdata.models.api_error_detail import ApiErrorDetail from hotdata.models.api_error_response import ApiErrorResponse from hotdata.models.async_query_response import AsyncQueryResponse @@ -103,6 +106,8 @@ from hotdata.models.list_workspaces_response import ListWorkspacesResponse from hotdata.models.load_managed_table_request import LoadManagedTableRequest from hotdata.models.load_managed_table_response import LoadManagedTableResponse +from hotdata.models.managed_schema_response import ManagedSchemaResponse +from hotdata.models.managed_table_response import ManagedTableResponse from hotdata.models.numeric_profile_detail import NumericProfileDetail from hotdata.models.query_request import QueryRequest from hotdata.models.query_response import QueryResponse diff --git a/hotdata/models/add_managed_schema_request.py b/hotdata/models/add_managed_schema_request.py new file mode 100644 index 0000000..97a5892 --- /dev/null +++ b/hotdata/models/add_managed_schema_request.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.add_managed_table_decl import AddManagedTableDecl +from typing import Optional, Set +from typing_extensions import Self + +class AddManagedSchemaRequest(BaseModel): + """ + Request body for adding a schema to an existing managed catalog: `POST /v1/connections/{id}/schemas` and `POST /v1/databases/{id}/schemas`. `tables` is optional — omit it to declare an empty schema and add tables later. + """ # noqa: E501 + name: StrictStr + tables: Optional[List[AddManagedTableDecl]] = 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 AddManagedSchemaRequest 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 AddManagedSchemaRequest 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": [AddManagedTableDecl.from_dict(_item) for _item in obj["tables"]] if obj.get("tables") is not None else None + }) + return _obj + + diff --git a/hotdata/models/add_managed_table_decl.py b/hotdata/models/add_managed_table_decl.py new file mode 100644 index 0000000..0a01d10 --- /dev/null +++ b/hotdata/models/add_managed_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 AddManagedTableDecl(BaseModel): + """ + One table declaration inside an add-schema request body. + """ # 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 AddManagedTableDecl 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 AddManagedTableDecl 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/add_managed_table_request.py b/hotdata/models/add_managed_table_request.py new file mode 100644 index 0000000..4a25adf --- /dev/null +++ b/hotdata/models/add_managed_table_request.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 AddManagedTableRequest(BaseModel): + """ + Request body for adding a table to an existing schema: `POST /v1/connections/{id}/schemas/{schema}/tables` and `POST /v1/databases/{id}/schemas/{schema}/tables`. + """ # 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 AddManagedTableRequest 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 AddManagedTableRequest 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/managed_schema_response.py b/hotdata/models/managed_schema_response.py new file mode 100644 index 0000000..9449067 --- /dev/null +++ b/hotdata/models/managed_schema_response.py @@ -0,0 +1,92 @@ +# 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 +from typing import Optional, Set +from typing_extensions import Self + +class ManagedSchemaResponse(BaseModel): + """ + Response body for a successful add-schema request. Echoes the normalised (lowercased) names so callers see exactly what was persisted. + """ # noqa: E501 + connection_id: StrictStr = Field(description="Connection backing the catalog the schema was added to. For a database default catalog this is the database's `default_connection_id`.") + var_schema: StrictStr = Field(alias="schema") + tables: List[StrictStr] + __properties: ClassVar[List[str]] = ["connection_id", "schema", "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 ManagedSchemaResponse 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 ManagedSchemaResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "connection_id": obj.get("connection_id"), + "schema": obj.get("schema"), + "tables": obj.get("tables") + }) + return _obj + + diff --git a/hotdata/models/managed_table_response.py b/hotdata/models/managed_table_response.py new file mode 100644 index 0000000..251be00 --- /dev/null +++ b/hotdata/models/managed_table_response.py @@ -0,0 +1,92 @@ +# 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 +from typing import Optional, Set +from typing_extensions import Self + +class ManagedTableResponse(BaseModel): + """ + Response body for a successful add-table request. + """ # noqa: E501 + connection_id: StrictStr + var_schema: StrictStr = Field(alias="schema") + table: StrictStr + __properties: ClassVar[List[str]] = ["connection_id", "schema", "table"] + + 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 ManagedTableResponse 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 ManagedTableResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "connection_id": obj.get("connection_id"), + "schema": obj.get("schema"), + "table": obj.get("table") + }) + return _obj + + diff --git a/test/test_add_managed_schema_request.py b/test/test_add_managed_schema_request.py new file mode 100644 index 0000000..f54ca42 --- /dev/null +++ b/test/test_add_managed_schema_request.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.add_managed_schema_request import AddManagedSchemaRequest + +class TestAddManagedSchemaRequest(unittest.TestCase): + """AddManagedSchemaRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AddManagedSchemaRequest: + """Test AddManagedSchemaRequest + 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 `AddManagedSchemaRequest` + """ + model = AddManagedSchemaRequest() + if include_optional: + return AddManagedSchemaRequest( + name = '', + tables = [ + hotdata.models.add_managed_table_decl.AddManagedTableDecl( + name = '', ) + ] + ) + else: + return AddManagedSchemaRequest( + name = '', + ) + """ + + def testAddManagedSchemaRequest(self): + """Test AddManagedSchemaRequest""" + # 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_add_managed_table_decl.py b/test/test_add_managed_table_decl.py new file mode 100644 index 0000000..b3061f8 --- /dev/null +++ b/test/test_add_managed_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.add_managed_table_decl import AddManagedTableDecl + +class TestAddManagedTableDecl(unittest.TestCase): + """AddManagedTableDecl unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AddManagedTableDecl: + """Test AddManagedTableDecl + 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 `AddManagedTableDecl` + """ + model = AddManagedTableDecl() + if include_optional: + return AddManagedTableDecl( + name = '' + ) + else: + return AddManagedTableDecl( + name = '', + ) + """ + + def testAddManagedTableDecl(self): + """Test AddManagedTableDecl""" + # 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_add_managed_table_request.py b/test/test_add_managed_table_request.py new file mode 100644 index 0000000..f496173 --- /dev/null +++ b/test/test_add_managed_table_request.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.add_managed_table_request import AddManagedTableRequest + +class TestAddManagedTableRequest(unittest.TestCase): + """AddManagedTableRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AddManagedTableRequest: + """Test AddManagedTableRequest + 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 `AddManagedTableRequest` + """ + model = AddManagedTableRequest() + if include_optional: + return AddManagedTableRequest( + name = '' + ) + else: + return AddManagedTableRequest( + name = '', + ) + """ + + def testAddManagedTableRequest(self): + """Test AddManagedTableRequest""" + # 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_managed_schema_response.py b/test/test_managed_schema_response.py new file mode 100644 index 0000000..6b306c7 --- /dev/null +++ b/test/test_managed_schema_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.managed_schema_response import ManagedSchemaResponse + +class TestManagedSchemaResponse(unittest.TestCase): + """ManagedSchemaResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ManagedSchemaResponse: + """Test ManagedSchemaResponse + 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 `ManagedSchemaResponse` + """ + model = ManagedSchemaResponse() + if include_optional: + return ManagedSchemaResponse( + connection_id = '', + var_schema = '', + tables = [ + '' + ] + ) + else: + return ManagedSchemaResponse( + connection_id = '', + var_schema = '', + tables = [ + '' + ], + ) + """ + + def testManagedSchemaResponse(self): + """Test ManagedSchemaResponse""" + # 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_managed_table_response.py b/test/test_managed_table_response.py new file mode 100644 index 0000000..c496163 --- /dev/null +++ b/test/test_managed_table_response.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.managed_table_response import ManagedTableResponse + +class TestManagedTableResponse(unittest.TestCase): + """ManagedTableResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ManagedTableResponse: + """Test ManagedTableResponse + 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 `ManagedTableResponse` + """ + model = ManagedTableResponse() + if include_optional: + return ManagedTableResponse( + connection_id = '', + var_schema = '', + table = '' + ) + else: + return ManagedTableResponse( + connection_id = '', + var_schema = '', + table = '', + ) + """ + + def testManagedTableResponse(self): + """Test ManagedTableResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()