diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 78006a5..58067ca 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -38,6 +38,11 @@ docs/CreateSecretResponse.md docs/CreateWorkspaceRequest.md docs/CreateWorkspaceResponse.md docs/DatasetSource.md +docs/DatasetSourceOneOf.md +docs/DatasetSourceOneOf1.md +docs/DatasetSourceOneOf2.md +docs/DatasetSourceOneOf3.md +docs/DatasetSourceOneOf4.md docs/DatasetSummary.md docs/DatasetVersionSummary.md docs/DatasetsApi.md @@ -191,6 +196,11 @@ hotdata/models/create_secret_response.py hotdata/models/create_workspace_request.py hotdata/models/create_workspace_response.py hotdata/models/dataset_source.py +hotdata/models/dataset_source_one_of.py +hotdata/models/dataset_source_one_of1.py +hotdata/models/dataset_source_one_of2.py +hotdata/models/dataset_source_one_of3.py +hotdata/models/dataset_source_one_of4.py hotdata/models/dataset_summary.py hotdata/models/dataset_version_summary.py hotdata/models/delete_sandbox_response.py @@ -275,14 +285,9 @@ hotdata/rest.py pyproject.toml requirements.txt setup.cfg -setup.py test-requirements.txt test/__init__.py -test/test_create_sandbox_request.py -test/test_delete_sandbox_response.py -test/test_list_sandboxes_response.py -test/test_sandbox.py -test/test_sandbox_response.py -test/test_sandboxes_api.py -test/test_update_sandbox_request.py +test/test_dataset_source_one_of2.py +test/test_dataset_source_one_of3.py +test/test_dataset_source_one_of4.py tox.ini diff --git a/docs/CreateIndexRequest.md b/docs/CreateIndexRequest.md index 4fb1a4f..baa0276 100644 --- a/docs/CreateIndexRequest.md +++ b/docs/CreateIndexRequest.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **var_async** | **bool** | When true, create the index as a background job and return a job ID for polling. | [optional] **columns** | **List[str]** | Columns to index. Required for all index types. | **description** | **str** | User-facing description of the embedding (e.g., \"product descriptions\"). | [optional] -**dimensions** | **int** | Output vector dimensions. Some models support multiple dimension sizes (e.g., OpenAI text-embedding-3-small supports 512 or 1536). If omitted, the model's default dimensions are used. | [optional] +**dimensions** | **int** | Output vector dimensions. Some models support multiple dimension sizes (e.g., OpenAI text-embedding-3-small supports 512 or 1536). If omitted, the model's default dimensions are used | [optional] **embedding_provider_id** | **str** | Embedding provider ID. When set for a vector index, the source column is treated as text and embeddings are generated automatically. The vector index is then built on the generated embedding column (`{column}_embedding` by default). | [optional] **index_name** | **str** | | **index_type** | **str** | Index type: \"sorted\" (default), \"bm25\", or \"vector\" | [optional] diff --git a/docs/DatasetSource.md b/docs/DatasetSource.md index 16d43c5..14d01fb 100644 --- a/docs/DatasetSource.md +++ b/docs/DatasetSource.md @@ -1,6 +1,6 @@ # DatasetSource -Dataset source specification +Dataset source specification. Internally tagged on `type`, e.g. `{\"type\": \"upload\", \"upload_id\": \"...\"}`. Discriminator values: `upload`, `saved_query`, `sql_query`, `url`, `inline`. ## Properties @@ -9,6 +9,7 @@ Name | Type | Description | Notes **columns** | **Dict[str, str]** | Optional explicit column definitions. Keys are column names, values are type specs. | [optional] **format** | **str** | | [optional] **upload_id** | **str** | | +**type** | **str** | | **saved_query_id** | **str** | | **version** | **int** | | [optional] **description** | **str** | Optional description for the auto-created saved query. | [optional] diff --git a/docs/DatasetSourceOneOf.md b/docs/DatasetSourceOneOf.md index afd4c13..aa924e7 100644 --- a/docs/DatasetSourceOneOf.md +++ b/docs/DatasetSourceOneOf.md @@ -1,14 +1,14 @@ # DatasetSourceOneOf -Create from a previously uploaded file ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**columns** | [**Dict[str, ColumnDefinition]**](ColumnDefinition.md) | Optional explicit column definitions. Keys are column names, values are type specs. When provided, the schema is built from these definitions instead of being inferred. | [optional] -**format** | **object** | | [optional] +**columns** | **Dict[str, str]** | Optional explicit column definitions. Keys are column names, values are type specs. When provided, the schema is built from these definitions instead of being inferred. | [optional] +**format** | **str** | | [optional] **upload_id** | **str** | | +**type** | **str** | | ## Example diff --git a/docs/DatasetSourceOneOf1.md b/docs/DatasetSourceOneOf1.md index 7a40e86..5587e12 100644 --- a/docs/DatasetSourceOneOf1.md +++ b/docs/DatasetSourceOneOf1.md @@ -1,12 +1,13 @@ # DatasetSourceOneOf1 -Create from inline data (small payloads) ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**inline** | [**InlineData**](InlineData.md) | | +**saved_query_id** | **str** | | +**version** | **int** | | [optional] +**type** | **str** | | ## Example diff --git a/docs/DatasetSourceOneOf2.md b/docs/DatasetSourceOneOf2.md new file mode 100644 index 0000000..8a4f995 --- /dev/null +++ b/docs/DatasetSourceOneOf2.md @@ -0,0 +1,32 @@ +# DatasetSourceOneOf2 + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **str** | Optional description for the auto-created saved query. | [optional] +**name** | **str** | Optional name for the auto-created saved query. Defaults to the dataset label. | [optional] +**sql** | **str** | | +**type** | **str** | | + +## Example + +```python +from hotdata.models.dataset_source_one_of2 import DatasetSourceOneOf2 + +# TODO update the JSON string below +json = "{}" +# create an instance of DatasetSourceOneOf2 from a JSON string +dataset_source_one_of2_instance = DatasetSourceOneOf2.from_json(json) +# print the JSON string representation of the object +print(DatasetSourceOneOf2.to_json()) + +# convert the object into a dict +dataset_source_one_of2_dict = dataset_source_one_of2_instance.to_dict() +# create an instance of DatasetSourceOneOf2 from a dict +dataset_source_one_of2_from_dict = DatasetSourceOneOf2.from_dict(dataset_source_one_of2_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/DatasetSourceOneOf3.md b/docs/DatasetSourceOneOf3.md new file mode 100644 index 0000000..5d43931 --- /dev/null +++ b/docs/DatasetSourceOneOf3.md @@ -0,0 +1,32 @@ +# DatasetSourceOneOf3 + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**columns** | **Dict[str, str]** | Optional explicit column definitions. Keys are column names, values are type specs. | [optional] +**format** | **str** | | [optional] +**url** | **str** | | +**type** | **str** | | + +## Example + +```python +from hotdata.models.dataset_source_one_of3 import DatasetSourceOneOf3 + +# TODO update the JSON string below +json = "{}" +# create an instance of DatasetSourceOneOf3 from a JSON string +dataset_source_one_of3_instance = DatasetSourceOneOf3.from_json(json) +# print the JSON string representation of the object +print(DatasetSourceOneOf3.to_json()) + +# convert the object into a dict +dataset_source_one_of3_dict = dataset_source_one_of3_instance.to_dict() +# create an instance of DatasetSourceOneOf3 from a dict +dataset_source_one_of3_from_dict = DatasetSourceOneOf3.from_dict(dataset_source_one_of3_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/DatasetSourceOneOf4.md b/docs/DatasetSourceOneOf4.md new file mode 100644 index 0000000..e6b2f4d --- /dev/null +++ b/docs/DatasetSourceOneOf4.md @@ -0,0 +1,30 @@ +# DatasetSourceOneOf4 + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inline** | [**InlineData**](InlineData.md) | | +**type** | **str** | | + +## Example + +```python +from hotdata.models.dataset_source_one_of4 import DatasetSourceOneOf4 + +# TODO update the JSON string below +json = "{}" +# create an instance of DatasetSourceOneOf4 from a JSON string +dataset_source_one_of4_instance = DatasetSourceOneOf4.from_json(json) +# print the JSON string representation of the object +print(DatasetSourceOneOf4.to_json()) + +# convert the object into a dict +dataset_source_one_of4_dict = dataset_source_one_of4_instance.to_dict() +# create an instance of DatasetSourceOneOf4 from a dict +dataset_source_one_of4_from_dict = DatasetSourceOneOf4.from_dict(dataset_source_one_of4_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/IndexesApi.md b/docs/IndexesApi.md index 8adb1f6..061a530 100644 --- a/docs/IndexesApi.md +++ b/docs/IndexesApi.md @@ -4,11 +4,112 @@ All URIs are relative to *https://api.hotdata.dev* Method | HTTP request | Description ------------- | ------------- | ------------- +[**create_dataset_index**](IndexesApi.md#create_dataset_index) | **POST** /v1/datasets/{dataset_id}/indexes | Create an index on a dataset [**create_index**](IndexesApi.md#create_index) | **POST** /v1/connections/{connection_id}/tables/{schema}/{table}/indexes | Create an index on a table +[**delete_dataset_index**](IndexesApi.md#delete_dataset_index) | **DELETE** /v1/datasets/{dataset_id}/indexes/{index_name} | Delete a dataset index [**delete_index**](IndexesApi.md#delete_index) | **DELETE** /v1/connections/{connection_id}/tables/{schema}/{table}/indexes/{index_name} | Delete an index +[**list_dataset_indexes**](IndexesApi.md#list_dataset_indexes) | **GET** /v1/datasets/{dataset_id}/indexes | List indexes on a dataset [**list_indexes**](IndexesApi.md#list_indexes) | **GET** /v1/connections/{connection_id}/tables/{schema}/{table}/indexes | List indexes on a table +# **create_dataset_index** +> IndexInfoResponse create_dataset_index(dataset_id, create_index_request) + +Create an index on a dataset + +Create a sorted, BM25, or vector index on a dataset. + +### Example + +* Api Key Authentication (WorkspaceId): +* Api Key Authentication (SessionId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.create_index_request import CreateIndexRequest +from hotdata.models.index_info_response import IndexInfoResponse +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 API key authorization: SessionId +configuration.api_key['SessionId'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['SessionId'] = '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.IndexesApi(api_client) + dataset_id = 'dataset_id_example' # str | Dataset identifier + create_index_request = hotdata.CreateIndexRequest() # CreateIndexRequest | + + try: + # Create an index on a dataset + api_response = api_instance.create_dataset_index(dataset_id, create_index_request) + print("The response of IndexesApi->create_dataset_index:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling IndexesApi->create_dataset_index: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **dataset_id** | **str**| Dataset identifier | + **create_index_request** | [**CreateIndexRequest**](CreateIndexRequest.md)| | + +### Return type + +[**IndexInfoResponse**](IndexInfoResponse.md) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [SessionId](../README.md#SessionId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Index created | - | +**400** | Invalid request | - | +**404** | Dataset not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **create_index** > IndexInfoResponse create_index(connection_id, var_schema, table, create_index_request) @@ -104,6 +205,98 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **delete_dataset_index** +> delete_dataset_index(dataset_id, index_name) + +Delete a dataset index + +Delete a specific index from a dataset. + +### Example + +* Api Key Authentication (WorkspaceId): +* Api Key Authentication (SessionId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.hotdata.dev +# See configuration.py for a list of all supported configuration parameters. +configuration = hotdata.Configuration( + host = "https://api.hotdata.dev" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: WorkspaceId +configuration.api_key['WorkspaceId'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['WorkspaceId'] = 'Bearer' + +# Configure API key authorization: SessionId +configuration.api_key['SessionId'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['SessionId'] = '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.IndexesApi(api_client) + dataset_id = 'dataset_id_example' # str | Dataset identifier + index_name = 'index_name_example' # str | Index name + + try: + # Delete a dataset index + api_instance.delete_dataset_index(dataset_id, index_name) + except Exception as e: + print("Exception when calling IndexesApi->delete_dataset_index: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **dataset_id** | **str**| Dataset identifier | + **index_name** | **str**| Index name | + +### Return type + +void (empty response body) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [SessionId](../README.md#SessionId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Index deleted | - | +**404** | Index or dataset not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **delete_index** > delete_index(connection_id, var_schema, table, index_name) @@ -194,6 +387,99 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **list_dataset_indexes** +> ListIndexesResponse list_dataset_indexes(dataset_id) + +List indexes on a dataset + +List all indexes created on a dataset. + +### Example + +* Api Key Authentication (WorkspaceId): +* Api Key Authentication (SessionId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.list_indexes_response import ListIndexesResponse +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 API key authorization: SessionId +configuration.api_key['SessionId'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['SessionId'] = '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.IndexesApi(api_client) + dataset_id = 'dataset_id_example' # str | Dataset identifier + + try: + # List indexes on a dataset + api_response = api_instance.list_dataset_indexes(dataset_id) + print("The response of IndexesApi->list_dataset_indexes:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling IndexesApi->list_dataset_indexes: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **dataset_id** | **str**| Dataset identifier | + +### Return type + +[**ListIndexesResponse**](ListIndexesResponse.md) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [SessionId](../README.md#SessionId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Indexes listed | - | +**404** | Dataset not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **list_indexes** > ListIndexesResponse list_indexes(connection_id, var_schema, table) diff --git a/docs/JobResult.md b/docs/JobResult.md index 4d72bb6..79c6fb9 100644 --- a/docs/JobResult.md +++ b/docs/JobResult.md @@ -16,12 +16,14 @@ Name | Type | Description | Notes **tables_failed** | **int** | | **tables_refreshed** | **int** | | **total_rows** | **int** | | -**columns** | **List[str]** | | **created_at** | **datetime** | | +**id** | **str** | | +**status** | [**IndexStatus**](IndexStatus.md) | | +**version** | **int** | | +**columns** | **List[str]** | | **index_name** | **str** | | **index_type** | **str** | | **metric** | **str** | Distance metric this index was built with. Only present for vector indexes. | [optional] -**status** | [**IndexStatus**](IndexStatus.md) | | **updated_at** | **datetime** | | ## Example diff --git a/docs/JobType.md b/docs/JobType.md index c5905a4..a3c9d43 100644 --- a/docs/JobType.md +++ b/docs/JobType.md @@ -10,8 +10,12 @@ Background job types returned by the API. * `DATA_REFRESH_CONNECTION` (value: `'data_refresh_connection'`) +* `DATASET_REFRESH` (value: `'dataset_refresh'`) + * `CREATE_INDEX` (value: `'create_index'`) +* `CREATE_DATASET_INDEX` (value: `'create_dataset_index'`) + [[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/RefreshApi.md b/docs/RefreshApi.md index e0d2c4f..a6c4e33 100644 --- a/docs/RefreshApi.md +++ b/docs/RefreshApi.md @@ -12,14 +12,15 @@ Method | HTTP request | Description Refresh connection data -Refresh schema metadata or table data. The behavior depends on the request fields: +Refresh schema metadata, table data, or dataset data. The behavior depends on the request fields: - **Schema refresh (all)**: omit all fields — re-discovers tables for every connection. - **Schema refresh (single)**: set `connection_id` — re-discovers tables for one connection. - **Data refresh (single table)**: set `connection_id`, `schema_name`, `table_name`, and `data: true`. - **Data refresh (connection)**: set `connection_id` and `data: true` — refreshes all cached tables. Set `include_uncached: true` to also sync tables that haven't been cached yet. +- **Dataset refresh**: set `dataset_id` — re-runs the dataset's source (URL fetch or saved query) and creates a new version. Mutually exclusive with `connection_id`. -Set `async: true` on data refresh operations to run in the background and return a job ID for polling. +Set `async: true` on data or dataset refresh operations to run in the background and return a job ID for polling. ### Example diff --git a/hotdata/__init__.py b/hotdata/__init__.py index 0574fe5..157fc84 100644 --- a/hotdata/__init__.py +++ b/hotdata/__init__.py @@ -85,6 +85,11 @@ "CreateWorkspaceRequest", "CreateWorkspaceResponse", "DatasetSource", + "DatasetSourceOneOf", + "DatasetSourceOneOf1", + "DatasetSourceOneOf2", + "DatasetSourceOneOf3", + "DatasetSourceOneOf4", "DatasetSummary", "DatasetVersionSummary", "DeleteSandboxResponse", @@ -232,6 +237,11 @@ from hotdata.models.create_workspace_request import CreateWorkspaceRequest as CreateWorkspaceRequest from hotdata.models.create_workspace_response import CreateWorkspaceResponse as CreateWorkspaceResponse from hotdata.models.dataset_source import DatasetSource as DatasetSource +from hotdata.models.dataset_source_one_of import DatasetSourceOneOf as DatasetSourceOneOf +from hotdata.models.dataset_source_one_of1 import DatasetSourceOneOf1 as DatasetSourceOneOf1 +from hotdata.models.dataset_source_one_of2 import DatasetSourceOneOf2 as DatasetSourceOneOf2 +from hotdata.models.dataset_source_one_of3 import DatasetSourceOneOf3 as DatasetSourceOneOf3 +from hotdata.models.dataset_source_one_of4 import DatasetSourceOneOf4 as DatasetSourceOneOf4 from hotdata.models.dataset_summary import DatasetSummary as DatasetSummary from hotdata.models.dataset_version_summary import DatasetVersionSummary as DatasetVersionSummary from hotdata.models.delete_sandbox_response import DeleteSandboxResponse as DeleteSandboxResponse diff --git a/hotdata/api/indexes_api.py b/hotdata/api/indexes_api.py index a291fec..cada327 100644 --- a/hotdata/api/indexes_api.py +++ b/hotdata/api/indexes_api.py @@ -41,11 +41,9 @@ def __init__(self, api_client=None) -> None: @validate_call - def create_index( + def create_dataset_index( self, - connection_id: Annotated[StrictStr, Field(description="Connection identifier")], - var_schema: Annotated[StrictStr, Field(description="Schema name")], - table: Annotated[StrictStr, Field(description="Table name")], + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], create_index_request: CreateIndexRequest, _request_timeout: Union[ None, @@ -60,16 +58,12 @@ def create_index( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> IndexInfoResponse: - """Create an index on a table + """Create an index on a dataset - Create a sorted or BM25 full-text index on a cached table. + Create a sorted, BM25, or vector index on a dataset. - :param connection_id: Connection identifier (required) - :type connection_id: str - :param var_schema: Schema name (required) - :type var_schema: str - :param table: Table name (required) - :type table: str + :param dataset_id: Dataset identifier (required) + :type dataset_id: str :param create_index_request: (required) :type create_index_request: CreateIndexRequest :param _request_timeout: timeout setting for this request. If one @@ -94,10 +88,8 @@ def create_index( :return: Returns the result object. """ # noqa: E501 - _param = self._create_index_serialize( - connection_id=connection_id, - var_schema=var_schema, - table=table, + _param = self._create_dataset_index_serialize( + dataset_id=dataset_id, create_index_request=create_index_request, _request_auth=_request_auth, _content_type=_content_type, @@ -123,11 +115,9 @@ def create_index( @validate_call - def create_index_with_http_info( + def create_dataset_index_with_http_info( self, - connection_id: Annotated[StrictStr, Field(description="Connection identifier")], - var_schema: Annotated[StrictStr, Field(description="Schema name")], - table: Annotated[StrictStr, Field(description="Table name")], + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], create_index_request: CreateIndexRequest, _request_timeout: Union[ None, @@ -142,16 +132,12 @@ def create_index_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[IndexInfoResponse]: - """Create an index on a table + """Create an index on a dataset - Create a sorted or BM25 full-text index on a cached table. + Create a sorted, BM25, or vector index on a dataset. - :param connection_id: Connection identifier (required) - :type connection_id: str - :param var_schema: Schema name (required) - :type var_schema: str - :param table: Table name (required) - :type table: str + :param dataset_id: Dataset identifier (required) + :type dataset_id: str :param create_index_request: (required) :type create_index_request: CreateIndexRequest :param _request_timeout: timeout setting for this request. If one @@ -176,10 +162,8 @@ def create_index_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._create_index_serialize( - connection_id=connection_id, - var_schema=var_schema, - table=table, + _param = self._create_dataset_index_serialize( + dataset_id=dataset_id, create_index_request=create_index_request, _request_auth=_request_auth, _content_type=_content_type, @@ -205,11 +189,9 @@ def create_index_with_http_info( @validate_call - def create_index_without_preload_content( + def create_dataset_index_without_preload_content( self, - connection_id: Annotated[StrictStr, Field(description="Connection identifier")], - var_schema: Annotated[StrictStr, Field(description="Schema name")], - table: Annotated[StrictStr, Field(description="Table name")], + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], create_index_request: CreateIndexRequest, _request_timeout: Union[ None, @@ -224,16 +206,12 @@ def create_index_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Create an index on a table + """Create an index on a dataset - Create a sorted or BM25 full-text index on a cached table. + Create a sorted, BM25, or vector index on a dataset. - :param connection_id: Connection identifier (required) - :type connection_id: str - :param var_schema: Schema name (required) - :type var_schema: str - :param table: Table name (required) - :type table: str + :param dataset_id: Dataset identifier (required) + :type dataset_id: str :param create_index_request: (required) :type create_index_request: CreateIndexRequest :param _request_timeout: timeout setting for this request. If one @@ -258,10 +236,8 @@ def create_index_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._create_index_serialize( - connection_id=connection_id, - var_schema=var_schema, - table=table, + _param = self._create_dataset_index_serialize( + dataset_id=dataset_id, create_index_request=create_index_request, _request_auth=_request_auth, _content_type=_content_type, @@ -282,11 +258,9 @@ def create_index_without_preload_content( return response_data.response - def _create_index_serialize( + def _create_dataset_index_serialize( self, - connection_id, - var_schema, - table, + dataset_id, create_index_request, _request_auth, _content_type, @@ -309,12 +283,8 @@ def _create_index_serialize( _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 - if table is not None: - _path_params['table'] = table + if dataset_id is not None: + _path_params['dataset_id'] = dataset_id # process the query parameters # process the header parameters # process the form parameters @@ -348,12 +318,13 @@ def _create_index_serialize( # authentication setting _auth_settings: List[str] = [ 'WorkspaceId', + 'SessionId', 'BearerAuth' ] return self.api_client.param_serialize( method='POST', - resource_path='/v1/connections/{connection_id}/tables/{schema}/{table}/indexes', + resource_path='/v1/datasets/{dataset_id}/indexes', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -370,12 +341,12 @@ def _create_index_serialize( @validate_call - def delete_index( + def create_index( self, connection_id: Annotated[StrictStr, Field(description="Connection identifier")], var_schema: Annotated[StrictStr, Field(description="Schema name")], table: Annotated[StrictStr, Field(description="Table name")], - index_name: Annotated[StrictStr, Field(description="Index name")], + create_index_request: CreateIndexRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -388,10 +359,10 @@ def delete_index( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> None: - """Delete an index + ) -> IndexInfoResponse: + """Create an index on a table - Delete a specific index from a cached table. + Create a sorted or BM25 full-text index on a cached table. :param connection_id: Connection identifier (required) :type connection_id: str @@ -399,8 +370,8 @@ def delete_index( :type var_schema: str :param table: Table name (required) :type table: str - :param index_name: Index name (required) - :type index_name: str + :param create_index_request: (required) + :type create_index_request: CreateIndexRequest :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 @@ -423,11 +394,11 @@ def delete_index( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_index_serialize( + _param = self._create_index_serialize( connection_id=connection_id, var_schema=var_schema, table=table, - index_name=index_name, + create_index_request=create_index_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -435,7 +406,8 @@ def delete_index( ) _response_types_map: Dict[str, Optional[str]] = { - '204': None, + '201': "IndexInfoResponse", + '400': "ApiErrorResponse", '404': "ApiErrorResponse", '500': "ApiErrorResponse", } @@ -451,12 +423,12 @@ def delete_index( @validate_call - def delete_index_with_http_info( + def create_index_with_http_info( self, connection_id: Annotated[StrictStr, Field(description="Connection identifier")], var_schema: Annotated[StrictStr, Field(description="Schema name")], table: Annotated[StrictStr, Field(description="Table name")], - index_name: Annotated[StrictStr, Field(description="Index name")], + create_index_request: CreateIndexRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -469,10 +441,10 @@ def delete_index_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: - """Delete an index + ) -> ApiResponse[IndexInfoResponse]: + """Create an index on a table - Delete a specific index from a cached table. + Create a sorted or BM25 full-text index on a cached table. :param connection_id: Connection identifier (required) :type connection_id: str @@ -480,8 +452,8 @@ def delete_index_with_http_info( :type var_schema: str :param table: Table name (required) :type table: str - :param index_name: Index name (required) - :type index_name: str + :param create_index_request: (required) + :type create_index_request: CreateIndexRequest :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 @@ -504,11 +476,11 @@ def delete_index_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_index_serialize( + _param = self._create_index_serialize( connection_id=connection_id, var_schema=var_schema, table=table, - index_name=index_name, + create_index_request=create_index_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -516,7 +488,8 @@ def delete_index_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '204': None, + '201': "IndexInfoResponse", + '400': "ApiErrorResponse", '404': "ApiErrorResponse", '500': "ApiErrorResponse", } @@ -532,12 +505,12 @@ def delete_index_with_http_info( @validate_call - def delete_index_without_preload_content( + def create_index_without_preload_content( self, connection_id: Annotated[StrictStr, Field(description="Connection identifier")], var_schema: Annotated[StrictStr, Field(description="Schema name")], table: Annotated[StrictStr, Field(description="Table name")], - index_name: Annotated[StrictStr, Field(description="Index name")], + create_index_request: CreateIndexRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -551,9 +524,9 @@ def delete_index_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Delete an index + """Create an index on a table - Delete a specific index from a cached table. + Create a sorted or BM25 full-text index on a cached table. :param connection_id: Connection identifier (required) :type connection_id: str @@ -561,8 +534,8 @@ def delete_index_without_preload_content( :type var_schema: str :param table: Table name (required) :type table: str - :param index_name: Index name (required) - :type index_name: str + :param create_index_request: (required) + :type create_index_request: CreateIndexRequest :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 @@ -585,11 +558,11 @@ def delete_index_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_index_serialize( + _param = self._create_index_serialize( connection_id=connection_id, var_schema=var_schema, table=table, - index_name=index_name, + create_index_request=create_index_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -597,7 +570,8 @@ def delete_index_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '204': None, + '201': "IndexInfoResponse", + '400': "ApiErrorResponse", '404': "ApiErrorResponse", '500': "ApiErrorResponse", } @@ -608,12 +582,12 @@ def delete_index_without_preload_content( return response_data.response - def _delete_index_serialize( + def _create_index_serialize( self, connection_id, var_schema, table, - index_name, + create_index_request, _request_auth, _content_type, _headers, @@ -641,12 +615,12 @@ def _delete_index_serialize( _path_params['schema'] = var_schema if table is not None: _path_params['table'] = table - if index_name is not None: - _path_params['index_name'] = index_name # process the query parameters # process the header parameters # process the form parameters # process the body parameter + if create_index_request is not None: + _body_params = create_index_request # set the HTTP header `Accept` @@ -657,6 +631,19 @@ def _delete_index_serialize( ] ) + # 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] = [ @@ -665,8 +652,868 @@ def _delete_index_serialize( ] return self.api_client.param_serialize( - method='DELETE', - resource_path='/v1/connections/{connection_id}/tables/{schema}/{table}/indexes/{index_name}', + method='POST', + resource_path='/v1/connections/{connection_id}/tables/{schema}/{table}/indexes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_dataset_index( + self, + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], + index_name: Annotated[StrictStr, Field(description="Index name")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a dataset index + + Delete a specific index from a dataset. + + :param dataset_id: Dataset identifier (required) + :type dataset_id: str + :param index_name: Index name (required) + :type index_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_dataset_index_serialize( + dataset_id=dataset_id, + index_name=index_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_dataset_index_with_http_info( + self, + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], + index_name: Annotated[StrictStr, Field(description="Index name")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a dataset index + + Delete a specific index from a dataset. + + :param dataset_id: Dataset identifier (required) + :type dataset_id: str + :param index_name: Index name (required) + :type index_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_dataset_index_serialize( + dataset_id=dataset_id, + index_name=index_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_dataset_index_without_preload_content( + self, + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], + index_name: Annotated[StrictStr, Field(description="Index name")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a dataset index + + Delete a specific index from a dataset. + + :param dataset_id: Dataset identifier (required) + :type dataset_id: str + :param index_name: Index name (required) + :type index_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_dataset_index_serialize( + dataset_id=dataset_id, + index_name=index_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_dataset_index_serialize( + self, + dataset_id, + index_name, + _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 dataset_id is not None: + _path_params['dataset_id'] = dataset_id + if index_name is not None: + _path_params['index_name'] = index_name + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'SessionId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/datasets/{dataset_id}/indexes/{index_name}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_index( + self, + connection_id: Annotated[StrictStr, Field(description="Connection identifier")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], + index_name: Annotated[StrictStr, Field(description="Index name")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete an index + + Delete a specific index from a cached table. + + :param connection_id: Connection identifier (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: str + :param index_name: Index name (required) + :type index_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_index_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, + index_name=index_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + '500': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_index_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Connection identifier")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], + index_name: Annotated[StrictStr, Field(description="Index name")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete an index + + Delete a specific index from a cached table. + + :param connection_id: Connection identifier (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: str + :param index_name: Index name (required) + :type index_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_index_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, + index_name=index_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + '500': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_index_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Connection identifier")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], + index_name: Annotated[StrictStr, Field(description="Index name")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete an index + + Delete a specific index from a cached table. + + :param connection_id: Connection identifier (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: str + :param index_name: Index name (required) + :type index_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_index_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, + index_name=index_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '404': "ApiErrorResponse", + '500': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_index_serialize( + self, + connection_id, + var_schema, + table, + index_name, + _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 + if table is not None: + _path_params['table'] = table + if index_name is not None: + _path_params['index_name'] = index_name + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/connections/{connection_id}/tables/{schema}/{table}/indexes/{index_name}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_dataset_indexes( + self, + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], + _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, + ) -> ListIndexesResponse: + """List indexes on a dataset + + List all indexes created on a dataset. + + :param dataset_id: Dataset identifier (required) + :type dataset_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_dataset_indexes_serialize( + dataset_id=dataset_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListIndexesResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_dataset_indexes_with_http_info( + self, + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], + _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[ListIndexesResponse]: + """List indexes on a dataset + + List all indexes created on a dataset. + + :param dataset_id: Dataset identifier (required) + :type dataset_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_dataset_indexes_serialize( + dataset_id=dataset_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListIndexesResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_dataset_indexes_without_preload_content( + self, + dataset_id: Annotated[StrictStr, Field(description="Dataset identifier")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List indexes on a dataset + + List all indexes created on a dataset. + + :param dataset_id: Dataset identifier (required) + :type dataset_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_dataset_indexes_serialize( + dataset_id=dataset_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListIndexesResponse", + '404': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_dataset_indexes_serialize( + self, + dataset_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if dataset_id is not None: + _path_params['dataset_id'] = dataset_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'SessionId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/datasets/{dataset_id}/indexes', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/hotdata/api/refresh_api.py b/hotdata/api/refresh_api.py index 1708bf2..71867c7 100644 --- a/hotdata/api/refresh_api.py +++ b/hotdata/api/refresh_api.py @@ -56,7 +56,7 @@ def refresh( ) -> RefreshResponse: """Refresh connection data - Refresh schema metadata or table data. The behavior depends on the request fields: - **Schema refresh (all)**: omit all fields — re-discovers tables for every connection. - **Schema refresh (single)**: set `connection_id` — re-discovers tables for one connection. - **Data refresh (single table)**: set `connection_id`, `schema_name`, `table_name`, and `data: true`. - **Data refresh (connection)**: set `connection_id` and `data: true` — refreshes all cached tables. Set `include_uncached: true` to also sync tables that haven't been cached yet. Set `async: true` on data refresh operations to run in the background and return a job ID for polling. + Refresh schema metadata, table data, or dataset data. The behavior depends on the request fields: - **Schema refresh (all)**: omit all fields — re-discovers tables for every connection. - **Schema refresh (single)**: set `connection_id` — re-discovers tables for one connection. - **Data refresh (single table)**: set `connection_id`, `schema_name`, `table_name`, and `data: true`. - **Data refresh (connection)**: set `connection_id` and `data: true` — refreshes all cached tables. Set `include_uncached: true` to also sync tables that haven't been cached yet. - **Dataset refresh**: set `dataset_id` — re-runs the dataset's source (URL fetch or saved query) and creates a new version. Mutually exclusive with `connection_id`. Set `async: true` on data or dataset refresh operations to run in the background and return a job ID for polling. :param refresh_request: (required) :type refresh_request: RefreshRequest @@ -125,7 +125,7 @@ def refresh_with_http_info( ) -> ApiResponse[RefreshResponse]: """Refresh connection data - Refresh schema metadata or table data. The behavior depends on the request fields: - **Schema refresh (all)**: omit all fields — re-discovers tables for every connection. - **Schema refresh (single)**: set `connection_id` — re-discovers tables for one connection. - **Data refresh (single table)**: set `connection_id`, `schema_name`, `table_name`, and `data: true`. - **Data refresh (connection)**: set `connection_id` and `data: true` — refreshes all cached tables. Set `include_uncached: true` to also sync tables that haven't been cached yet. Set `async: true` on data refresh operations to run in the background and return a job ID for polling. + Refresh schema metadata, table data, or dataset data. The behavior depends on the request fields: - **Schema refresh (all)**: omit all fields — re-discovers tables for every connection. - **Schema refresh (single)**: set `connection_id` — re-discovers tables for one connection. - **Data refresh (single table)**: set `connection_id`, `schema_name`, `table_name`, and `data: true`. - **Data refresh (connection)**: set `connection_id` and `data: true` — refreshes all cached tables. Set `include_uncached: true` to also sync tables that haven't been cached yet. - **Dataset refresh**: set `dataset_id` — re-runs the dataset's source (URL fetch or saved query) and creates a new version. Mutually exclusive with `connection_id`. Set `async: true` on data or dataset refresh operations to run in the background and return a job ID for polling. :param refresh_request: (required) :type refresh_request: RefreshRequest @@ -194,7 +194,7 @@ def refresh_without_preload_content( ) -> RESTResponseType: """Refresh connection data - Refresh schema metadata or table data. The behavior depends on the request fields: - **Schema refresh (all)**: omit all fields — re-discovers tables for every connection. - **Schema refresh (single)**: set `connection_id` — re-discovers tables for one connection. - **Data refresh (single table)**: set `connection_id`, `schema_name`, `table_name`, and `data: true`. - **Data refresh (connection)**: set `connection_id` and `data: true` — refreshes all cached tables. Set `include_uncached: true` to also sync tables that haven't been cached yet. Set `async: true` on data refresh operations to run in the background and return a job ID for polling. + Refresh schema metadata, table data, or dataset data. The behavior depends on the request fields: - **Schema refresh (all)**: omit all fields — re-discovers tables for every connection. - **Schema refresh (single)**: set `connection_id` — re-discovers tables for one connection. - **Data refresh (single table)**: set `connection_id`, `schema_name`, `table_name`, and `data: true`. - **Data refresh (connection)**: set `connection_id` and `data: true` — refreshes all cached tables. Set `include_uncached: true` to also sync tables that haven't been cached yet. - **Dataset refresh**: set `dataset_id` — re-runs the dataset's source (URL fetch or saved query) and creates a new version. Mutually exclusive with `connection_id`. Set `async: true` on data or dataset refresh operations to run in the background and return a job ID for polling. :param refresh_request: (required) :type refresh_request: RefreshRequest diff --git a/hotdata/api_client.py b/hotdata/api_client.py index 926507e..bc3e660 100644 --- a/hotdata/api_client.py +++ b/hotdata/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.user_agent = 'OpenAPI-Generator/0.1.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/hotdata/models/__init__.py b/hotdata/models/__init__.py index 0541d21..8ffe434 100644 --- a/hotdata/models/__init__.py +++ b/hotdata/models/__init__.py @@ -49,6 +49,11 @@ from hotdata.models.create_workspace_request import CreateWorkspaceRequest from hotdata.models.create_workspace_response import CreateWorkspaceResponse from hotdata.models.dataset_source import DatasetSource +from hotdata.models.dataset_source_one_of import DatasetSourceOneOf +from hotdata.models.dataset_source_one_of1 import DatasetSourceOneOf1 +from hotdata.models.dataset_source_one_of2 import DatasetSourceOneOf2 +from hotdata.models.dataset_source_one_of3 import DatasetSourceOneOf3 +from hotdata.models.dataset_source_one_of4 import DatasetSourceOneOf4 from hotdata.models.dataset_summary import DatasetSummary from hotdata.models.dataset_version_summary import DatasetVersionSummary from hotdata.models.delete_sandbox_response import DeleteSandboxResponse diff --git a/hotdata/models/create_index_request.py b/hotdata/models/create_index_request.py index ecb2d2c..faebe33 100644 --- a/hotdata/models/create_index_request.py +++ b/hotdata/models/create_index_request.py @@ -31,7 +31,7 @@ class CreateIndexRequest(BaseModel): var_async: Optional[StrictBool] = Field(default=None, description="When true, create the index as a background job and return a job ID for polling.", alias="async") columns: List[StrictStr] = Field(description="Columns to index. Required for all index types.") description: Optional[StrictStr] = Field(default=None, description="User-facing description of the embedding (e.g., \"product descriptions\").") - dimensions: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Output vector dimensions. Some models support multiple dimension sizes (e.g., OpenAI text-embedding-3-small supports 512 or 1536). If omitted, the model's default dimensions are used.") + dimensions: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Output vector dimensions. Some models support multiple dimension sizes (e.g., OpenAI text-embedding-3-small supports 512 or 1536). If omitted, the model's default dimensions are used") embedding_provider_id: Optional[StrictStr] = Field(default=None, description="Embedding provider ID. When set for a vector index, the source column is treated as text and embeddings are generated automatically. The vector index is then built on the generated embedding column (`{column}_embedding` by default).") index_name: StrictStr index_type: Optional[StrictStr] = Field(default=None, description="Index type: \"sorted\" (default), \"bm25\", or \"vector\"") diff --git a/hotdata/models/dataset_source.py b/hotdata/models/dataset_source.py index 744857b..4a3ecfb 100644 --- a/hotdata/models/dataset_source.py +++ b/hotdata/models/dataset_source.py @@ -18,33 +18,33 @@ import pprint from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional -from hotdata.models.inline_dataset_source import InlineDatasetSource -from hotdata.models.saved_query_dataset_source import SavedQueryDatasetSource -from hotdata.models.sql_query_dataset_source import SqlQueryDatasetSource -from hotdata.models.upload_dataset_source import UploadDatasetSource -from hotdata.models.url_dataset_source import UrlDatasetSource +from hotdata.models.dataset_source_one_of import DatasetSourceOneOf +from hotdata.models.dataset_source_one_of1 import DatasetSourceOneOf1 +from hotdata.models.dataset_source_one_of2 import DatasetSourceOneOf2 +from hotdata.models.dataset_source_one_of3 import DatasetSourceOneOf3 +from hotdata.models.dataset_source_one_of4 import DatasetSourceOneOf4 from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -DATASETSOURCE_ONE_OF_SCHEMAS = ["InlineDatasetSource", "SavedQueryDatasetSource", "SqlQueryDatasetSource", "UploadDatasetSource", "UrlDatasetSource"] +DATASETSOURCE_ONE_OF_SCHEMAS = ["DatasetSourceOneOf", "DatasetSourceOneOf1", "DatasetSourceOneOf2", "DatasetSourceOneOf3", "DatasetSourceOneOf4"] class DatasetSource(BaseModel): """ - Dataset source specification + Dataset source specification. Internally tagged on `type`, e.g. `{\"type\": \"upload\", \"upload_id\": \"...\"}`. Discriminator values: `upload`, `saved_query`, `sql_query`, `url`, `inline`. """ - # data type: UploadDatasetSource - oneof_schema_1_validator: Optional[UploadDatasetSource] = None - # data type: SavedQueryDatasetSource - oneof_schema_2_validator: Optional[SavedQueryDatasetSource] = None - # data type: SqlQueryDatasetSource - oneof_schema_3_validator: Optional[SqlQueryDatasetSource] = None - # data type: UrlDatasetSource - oneof_schema_4_validator: Optional[UrlDatasetSource] = None - # data type: InlineDatasetSource - oneof_schema_5_validator: Optional[InlineDatasetSource] = None - actual_instance: Optional[Union[InlineDatasetSource, SavedQueryDatasetSource, SqlQueryDatasetSource, UploadDatasetSource, UrlDatasetSource]] = None - one_of_schemas: Set[str] = { "InlineDatasetSource", "SavedQueryDatasetSource", "SqlQueryDatasetSource", "UploadDatasetSource", "UrlDatasetSource" } + # data type: DatasetSourceOneOf + oneof_schema_1_validator: Optional[DatasetSourceOneOf] = None + # data type: DatasetSourceOneOf1 + oneof_schema_2_validator: Optional[DatasetSourceOneOf1] = None + # data type: DatasetSourceOneOf2 + oneof_schema_3_validator: Optional[DatasetSourceOneOf2] = None + # data type: DatasetSourceOneOf3 + oneof_schema_4_validator: Optional[DatasetSourceOneOf3] = None + # data type: DatasetSourceOneOf4 + oneof_schema_5_validator: Optional[DatasetSourceOneOf4] = None + actual_instance: Optional[Union[DatasetSourceOneOf, DatasetSourceOneOf1, DatasetSourceOneOf2, DatasetSourceOneOf3, DatasetSourceOneOf4]] = None + one_of_schemas: Set[str] = { "DatasetSourceOneOf", "DatasetSourceOneOf1", "DatasetSourceOneOf2", "DatasetSourceOneOf3", "DatasetSourceOneOf4" } model_config = ConfigDict( validate_assignment=True, @@ -67,37 +67,37 @@ def actual_instance_must_validate_oneof(cls, v): instance = DatasetSource.model_construct() error_messages = [] match = 0 - # validate data type: UploadDatasetSource - if not isinstance(v, UploadDatasetSource): - error_messages.append(f"Error! Input type `{type(v)}` is not `UploadDatasetSource`") + # validate data type: DatasetSourceOneOf + if not isinstance(v, DatasetSourceOneOf): + error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetSourceOneOf`") else: match += 1 - # validate data type: SavedQueryDatasetSource - if not isinstance(v, SavedQueryDatasetSource): - error_messages.append(f"Error! Input type `{type(v)}` is not `SavedQueryDatasetSource`") + # validate data type: DatasetSourceOneOf1 + if not isinstance(v, DatasetSourceOneOf1): + error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetSourceOneOf1`") else: match += 1 - # validate data type: SqlQueryDatasetSource - if not isinstance(v, SqlQueryDatasetSource): - error_messages.append(f"Error! Input type `{type(v)}` is not `SqlQueryDatasetSource`") + # validate data type: DatasetSourceOneOf2 + if not isinstance(v, DatasetSourceOneOf2): + error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetSourceOneOf2`") else: match += 1 - # validate data type: UrlDatasetSource - if not isinstance(v, UrlDatasetSource): - error_messages.append(f"Error! Input type `{type(v)}` is not `UrlDatasetSource`") + # validate data type: DatasetSourceOneOf3 + if not isinstance(v, DatasetSourceOneOf3): + error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetSourceOneOf3`") else: match += 1 - # validate data type: InlineDatasetSource - if not isinstance(v, InlineDatasetSource): - error_messages.append(f"Error! Input type `{type(v)}` is not `InlineDatasetSource`") + # validate data type: DatasetSourceOneOf4 + if not isinstance(v, DatasetSourceOneOf4): + error_messages.append(f"Error! Input type `{type(v)}` is not `DatasetSourceOneOf4`") else: match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in DatasetSource with oneOf schemas: InlineDatasetSource, SavedQueryDatasetSource, SqlQueryDatasetSource, UploadDatasetSource, UrlDatasetSource. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in DatasetSource with oneOf schemas: DatasetSourceOneOf, DatasetSourceOneOf1, DatasetSourceOneOf2, DatasetSourceOneOf3, DatasetSourceOneOf4. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in DatasetSource with oneOf schemas: InlineDatasetSource, SavedQueryDatasetSource, SqlQueryDatasetSource, UploadDatasetSource, UrlDatasetSource. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in DatasetSource with oneOf schemas: DatasetSourceOneOf, DatasetSourceOneOf1, DatasetSourceOneOf2, DatasetSourceOneOf3, DatasetSourceOneOf4. Details: " + ", ".join(error_messages)) else: return v @@ -112,43 +112,43 @@ def from_json(cls, json_str: str) -> Self: error_messages = [] match = 0 - # deserialize data into UploadDatasetSource + # deserialize data into DatasetSourceOneOf try: - instance.actual_instance = UploadDatasetSource.from_json(json_str) + instance.actual_instance = DatasetSourceOneOf.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into SavedQueryDatasetSource + # deserialize data into DatasetSourceOneOf1 try: - instance.actual_instance = SavedQueryDatasetSource.from_json(json_str) + instance.actual_instance = DatasetSourceOneOf1.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into SqlQueryDatasetSource + # deserialize data into DatasetSourceOneOf2 try: - instance.actual_instance = SqlQueryDatasetSource.from_json(json_str) + instance.actual_instance = DatasetSourceOneOf2.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into UrlDatasetSource + # deserialize data into DatasetSourceOneOf3 try: - instance.actual_instance = UrlDatasetSource.from_json(json_str) + instance.actual_instance = DatasetSourceOneOf3.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into InlineDatasetSource + # deserialize data into DatasetSourceOneOf4 try: - instance.actual_instance = InlineDatasetSource.from_json(json_str) + instance.actual_instance = DatasetSourceOneOf4.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into DatasetSource with oneOf schemas: InlineDatasetSource, SavedQueryDatasetSource, SqlQueryDatasetSource, UploadDatasetSource, UrlDatasetSource. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into DatasetSource with oneOf schemas: DatasetSourceOneOf, DatasetSourceOneOf1, DatasetSourceOneOf2, DatasetSourceOneOf3, DatasetSourceOneOf4. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into DatasetSource with oneOf schemas: InlineDatasetSource, SavedQueryDatasetSource, SqlQueryDatasetSource, UploadDatasetSource, UrlDatasetSource. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into DatasetSource with oneOf schemas: DatasetSourceOneOf, DatasetSourceOneOf1, DatasetSourceOneOf2, DatasetSourceOneOf3, DatasetSourceOneOf4. Details: " + ", ".join(error_messages)) else: return instance @@ -162,7 +162,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], InlineDatasetSource, SavedQueryDatasetSource, SqlQueryDatasetSource, UploadDatasetSource, UrlDatasetSource]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], DatasetSourceOneOf, DatasetSourceOneOf1, DatasetSourceOneOf2, DatasetSourceOneOf3, DatasetSourceOneOf4]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/hotdata/models/dataset_source_one_of.py b/hotdata/models/dataset_source_one_of.py index 95b0b9a..428883b 100644 --- a/hotdata/models/dataset_source_one_of.py +++ b/hotdata/models/dataset_source_one_of.py @@ -1,11 +1,12 @@ # coding: utf-8 """ - HotData API + 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. @@ -17,20 +18,27 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from hotdata.models.column_definition import ColumnDefinition from typing import Optional, Set from typing_extensions import Self class DatasetSourceOneOf(BaseModel): """ - Create from a previously uploaded file + DatasetSourceOneOf """ # noqa: E501 - columns: Optional[Dict[str, ColumnDefinition]] = Field(default=None, description="Optional explicit column definitions. Keys are column names, values are type specs. When provided, the schema is built from these definitions instead of being inferred.") - format: Optional[Any] = None + columns: Optional[Dict[str, StrictStr]] = Field(default=None, description="Optional explicit column definitions. Keys are column names, values are type specs. When provided, the schema is built from these definitions instead of being inferred.") + format: Optional[StrictStr] = None upload_id: StrictStr - __properties: ClassVar[List[str]] = ["columns", "format", "upload_id"] + type: StrictStr + __properties: ClassVar[List[str]] = ["columns", "format", "upload_id", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['upload']): + raise ValueError("must be one of enum values ('upload')") + return value model_config = ConfigDict( populate_by_name=True, @@ -71,18 +79,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each value in columns (dict) - _field_dict = {} - if self.columns: - for _key_columns in self.columns: - if self.columns[_key_columns]: - _field_dict[_key_columns] = self.columns[_key_columns].to_dict() - _dict['columns'] = _field_dict - # set to None if format (nullable) is None - # and model_fields_set contains the field - if self.format is None and "format" in self.model_fields_set: - _dict['format'] = None - return _dict @classmethod @@ -95,14 +91,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "columns": dict( - (_k, ColumnDefinition.from_dict(_v)) - for _k, _v in obj["columns"].items() - ) - if obj.get("columns") is not None - else None, + "columns": obj.get("columns"), "format": obj.get("format"), - "upload_id": obj.get("upload_id") + "upload_id": obj.get("upload_id"), + "type": obj.get("type") }) return _obj diff --git a/hotdata/models/dataset_source_one_of1.py b/hotdata/models/dataset_source_one_of1.py index 7230904..45fd516 100644 --- a/hotdata/models/dataset_source_one_of1.py +++ b/hotdata/models/dataset_source_one_of1.py @@ -1,11 +1,12 @@ # coding: utf-8 """ - HotData API + 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. @@ -17,18 +18,26 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict -from typing import Any, ClassVar, Dict, List -from hotdata.models.inline_data import InlineData +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self class DatasetSourceOneOf1(BaseModel): """ - Create from inline data (small payloads) + DatasetSourceOneOf1 """ # noqa: E501 - inline: InlineData - __properties: ClassVar[List[str]] = ["inline"] + saved_query_id: StrictStr + version: Optional[StrictInt] = None + type: StrictStr + __properties: ClassVar[List[str]] = ["saved_query_id", "version", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['saved_query']): + raise ValueError("must be one of enum values ('saved_query')") + return value model_config = ConfigDict( populate_by_name=True, @@ -69,9 +78,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of inline - if self.inline: - _dict['inline'] = self.inline.to_dict() return _dict @classmethod @@ -84,7 +90,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "inline": InlineData.from_dict(obj["inline"]) if obj.get("inline") is not None else None + "saved_query_id": obj.get("saved_query_id"), + "version": obj.get("version"), + "type": obj.get("type") }) return _obj diff --git a/hotdata/models/dataset_source_one_of2.py b/hotdata/models/dataset_source_one_of2.py new file mode 100644 index 0000000..c9227f2 --- /dev/null +++ b/hotdata/models/dataset_source_one_of2.py @@ -0,0 +1,101 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DatasetSourceOneOf2(BaseModel): + """ + DatasetSourceOneOf2 + """ # noqa: E501 + description: Optional[StrictStr] = Field(default=None, description="Optional description for the auto-created saved query.") + name: Optional[StrictStr] = Field(default=None, description="Optional name for the auto-created saved query. Defaults to the dataset label.") + sql: StrictStr + type: StrictStr + __properties: ClassVar[List[str]] = ["description", "name", "sql", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['sql_query']): + raise ValueError("must be one of enum values ('sql_query')") + return value + + 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 DatasetSourceOneOf2 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 DatasetSourceOneOf2 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description"), + "name": obj.get("name"), + "sql": obj.get("sql"), + "type": obj.get("type") + }) + return _obj + + diff --git a/hotdata/models/dataset_source_one_of3.py b/hotdata/models/dataset_source_one_of3.py new file mode 100644 index 0000000..a21f03b --- /dev/null +++ b/hotdata/models/dataset_source_one_of3.py @@ -0,0 +1,101 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DatasetSourceOneOf3(BaseModel): + """ + DatasetSourceOneOf3 + """ # noqa: E501 + columns: Optional[Dict[str, StrictStr]] = Field(default=None, description="Optional explicit column definitions. Keys are column names, values are type specs.") + format: Optional[StrictStr] = None + url: StrictStr + type: StrictStr + __properties: ClassVar[List[str]] = ["columns", "format", "url", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['url']): + raise ValueError("must be one of enum values ('url')") + return value + + 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 DatasetSourceOneOf3 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 DatasetSourceOneOf3 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "columns": obj.get("columns"), + "format": obj.get("format"), + "url": obj.get("url"), + "type": obj.get("type") + }) + return _obj + + diff --git a/hotdata/models/dataset_source_one_of4.py b/hotdata/models/dataset_source_one_of4.py new file mode 100644 index 0000000..463d298 --- /dev/null +++ b/hotdata/models/dataset_source_one_of4.py @@ -0,0 +1,101 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List +from hotdata.models.inline_data import InlineData +from typing import Optional, Set +from typing_extensions import Self + +class DatasetSourceOneOf4(BaseModel): + """ + DatasetSourceOneOf4 + """ # noqa: E501 + inline: InlineData + type: StrictStr + __properties: ClassVar[List[str]] = ["inline", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['inline']): + raise ValueError("must be one of enum values ('inline')") + return value + + 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 DatasetSourceOneOf4 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 inline + if self.inline: + _dict['inline'] = self.inline.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DatasetSourceOneOf4 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "inline": InlineData.from_dict(obj["inline"]) if obj.get("inline") is not None else None, + "type": obj.get("type") + }) + return _obj + + diff --git a/hotdata/models/job_result.py b/hotdata/models/job_result.py index ec31472..15d2778 100644 --- a/hotdata/models/job_result.py +++ b/hotdata/models/job_result.py @@ -20,12 +20,13 @@ from typing import Any, List, Optional from hotdata.models.connection_refresh_result import ConnectionRefreshResult from hotdata.models.index_info_response import IndexInfoResponse +from hotdata.models.refresh_dataset_response import RefreshDatasetResponse from hotdata.models.table_refresh_result import TableRefreshResult from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -JOBRESULT_ONE_OF_SCHEMAS = ["ConnectionRefreshResult", "IndexInfoResponse", "TableRefreshResult"] +JOBRESULT_ONE_OF_SCHEMAS = ["ConnectionRefreshResult", "IndexInfoResponse", "RefreshDatasetResponse", "TableRefreshResult"] class JobResult(BaseModel): """ @@ -35,10 +36,12 @@ class JobResult(BaseModel): oneof_schema_1_validator: Optional[TableRefreshResult] = Field(default=None, description="Result of a single table data refresh.") # data type: ConnectionRefreshResult oneof_schema_2_validator: Optional[ConnectionRefreshResult] = Field(default=None, description="Result of a connection-wide data refresh.") + # data type: RefreshDatasetResponse + oneof_schema_3_validator: Optional[RefreshDatasetResponse] = Field(default=None, description="Result of a dataset refresh.") # data type: IndexInfoResponse - oneof_schema_3_validator: Optional[IndexInfoResponse] = Field(default=None, description="Result of an index creation.") - actual_instance: Optional[Union[ConnectionRefreshResult, IndexInfoResponse, TableRefreshResult]] = None - one_of_schemas: Set[str] = { "ConnectionRefreshResult", "IndexInfoResponse", "TableRefreshResult" } + oneof_schema_4_validator: Optional[IndexInfoResponse] = Field(default=None, description="Result of an index creation.") + actual_instance: Optional[Union[ConnectionRefreshResult, IndexInfoResponse, RefreshDatasetResponse, TableRefreshResult]] = None + one_of_schemas: Set[str] = { "ConnectionRefreshResult", "IndexInfoResponse", "RefreshDatasetResponse", "TableRefreshResult" } model_config = ConfigDict( validate_assignment=True, @@ -71,6 +74,11 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `ConnectionRefreshResult`") else: match += 1 + # validate data type: RefreshDatasetResponse + if not isinstance(v, RefreshDatasetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `RefreshDatasetResponse`") + else: + match += 1 # validate data type: IndexInfoResponse if not isinstance(v, IndexInfoResponse): error_messages.append(f"Error! Input type `{type(v)}` is not `IndexInfoResponse`") @@ -78,10 +86,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, RefreshDatasetResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, RefreshDatasetResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) else: return v @@ -108,6 +116,12 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into RefreshDatasetResponse + try: + instance.actual_instance = RefreshDatasetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into IndexInfoResponse try: instance.actual_instance = IndexInfoResponse.from_json(json_str) @@ -117,10 +131,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, RefreshDatasetResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into JobResult with oneOf schemas: ConnectionRefreshResult, IndexInfoResponse, RefreshDatasetResponse, TableRefreshResult. Details: " + ", ".join(error_messages)) else: return instance @@ -134,7 +148,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], ConnectionRefreshResult, IndexInfoResponse, TableRefreshResult]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], ConnectionRefreshResult, IndexInfoResponse, RefreshDatasetResponse, TableRefreshResult]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/hotdata/models/job_type.py b/hotdata/models/job_type.py index 7783b49..3db4324 100644 --- a/hotdata/models/job_type.py +++ b/hotdata/models/job_type.py @@ -30,7 +30,9 @@ class JobType(str, Enum): NOOP = 'noop' DATA_REFRESH_TABLE = 'data_refresh_table' DATA_REFRESH_CONNECTION = 'data_refresh_connection' + DATASET_REFRESH = 'dataset_refresh' CREATE_INDEX = 'create_index' + CREATE_DATASET_INDEX = 'create_dataset_index' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/pyproject.toml b/pyproject.toml index 2af112b..d52bf27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "hotdata" version = "0.1.0" -description = "Official Python client for the Hotdata API" +description = "Hotdata API" authors = [ {name = "Hotdata",email = "developers@hotdata.dev"}, ] @@ -37,13 +37,6 @@ mypy = ">= 1.5" requires = ["setuptools"] build-backend = "setuptools.build_meta" -[tool.setuptools.packages.find] -include = ["hotdata*"] -exclude = ["test*", "tests*", "docs*"] - -[tool.setuptools.package-data] -hotdata = ["py.typed"] - [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" diff --git a/test/test_dataset_source_one_of2.py b/test/test_dataset_source_one_of2.py new file mode 100644 index 0000000..a5f701c --- /dev/null +++ b/test/test_dataset_source_one_of2.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.dataset_source_one_of2 import DatasetSourceOneOf2 + +class TestDatasetSourceOneOf2(unittest.TestCase): + """DatasetSourceOneOf2 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatasetSourceOneOf2: + """Test DatasetSourceOneOf2 + 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 `DatasetSourceOneOf2` + """ + model = DatasetSourceOneOf2() + if include_optional: + return DatasetSourceOneOf2( + description = '', + name = '', + sql = '', + type = 'sql_query' + ) + else: + return DatasetSourceOneOf2( + sql = '', + type = 'sql_query', + ) + """ + + def testDatasetSourceOneOf2(self): + """Test DatasetSourceOneOf2""" + # 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_dataset_source_one_of3.py b/test/test_dataset_source_one_of3.py new file mode 100644 index 0000000..c59df74 --- /dev/null +++ b/test/test_dataset_source_one_of3.py @@ -0,0 +1,59 @@ +# 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.dataset_source_one_of3 import DatasetSourceOneOf3 + +class TestDatasetSourceOneOf3(unittest.TestCase): + """DatasetSourceOneOf3 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatasetSourceOneOf3: + """Test DatasetSourceOneOf3 + 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 `DatasetSourceOneOf3` + """ + model = DatasetSourceOneOf3() + if include_optional: + return DatasetSourceOneOf3( + columns = { + 'key' : '' + }, + format = '', + url = '', + type = 'url' + ) + else: + return DatasetSourceOneOf3( + url = '', + type = 'url', + ) + """ + + def testDatasetSourceOneOf3(self): + """Test DatasetSourceOneOf3""" + # 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_dataset_source_one_of4.py b/test/test_dataset_source_one_of4.py new file mode 100644 index 0000000..2f7ef76 --- /dev/null +++ b/test/test_dataset_source_one_of4.py @@ -0,0 +1,65 @@ +# 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.dataset_source_one_of4 import DatasetSourceOneOf4 + +class TestDatasetSourceOneOf4(unittest.TestCase): + """DatasetSourceOneOf4 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DatasetSourceOneOf4: + """Test DatasetSourceOneOf4 + 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 `DatasetSourceOneOf4` + """ + model = DatasetSourceOneOf4() + if include_optional: + return DatasetSourceOneOf4( + inline = hotdata.models.inline_data.InlineData( + columns = { + 'key' : '' + }, + content = '', + format = '', ), + type = 'inline' + ) + else: + return DatasetSourceOneOf4( + inline = hotdata.models.inline_data.InlineData( + columns = { + 'key' : '' + }, + content = '', + format = '', ), + type = 'inline', + ) + """ + + def testDatasetSourceOneOf4(self): + """Test DatasetSourceOneOf4""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()