diff --git a/.gitignore b/.gitignore index 37ddc2d..65b06b9 100644 --- a/.gitignore +++ b/.gitignore @@ -64,5 +64,3 @@ target/ # Ipython Notebook .ipynb_checkpoints - -.DS_Store diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index a28cb02..c666a96 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -85,6 +85,8 @@ docs/ListSecretsResponse.md docs/ListUploadsResponse.md docs/ListWorkspaceContextsResponse.md docs/ListWorkspacesResponse.md +docs/LoadManagedTableRequest.md +docs/LoadManagedTableResponse.md docs/NumericProfileDetail.md docs/QueryApi.md docs/QueryRequest.md @@ -239,6 +241,8 @@ hotdata/models/list_secrets_response.py hotdata/models/list_uploads_response.py hotdata/models/list_workspace_contexts_response.py hotdata/models/list_workspaces_response.py +hotdata/models/load_managed_table_request.py +hotdata/models/load_managed_table_response.py hotdata/models/numeric_profile_detail.py hotdata/models/query_request.py hotdata/models/query_response.py @@ -289,4 +293,6 @@ requirements.txt setup.cfg test-requirements.txt test/__init__.py +test/test_load_managed_table_request.py +test/test_load_managed_table_response.py tox.ini diff --git a/docs/ConnectionsApi.md b/docs/ConnectionsApi.md index bfeee9a..35ffd8c 100644 --- a/docs/ConnectionsApi.md +++ b/docs/ConnectionsApi.md @@ -7,9 +7,11 @@ Method | HTTP request | Description [**check_connection_health**](ConnectionsApi.md#check_connection_health) | **GET** /v1/connections/{connection_id}/health | Check connection health [**create_connection**](ConnectionsApi.md#create_connection) | **POST** /v1/connections | Create connection [**delete_connection**](ConnectionsApi.md#delete_connection) | **DELETE** /v1/connections/{connection_id} | Delete connection +[**delete_managed_table**](ConnectionsApi.md#delete_managed_table) | **DELETE** /v1/connections/{connection_id}/schemas/{schema}/tables/{table} | Delete managed table [**get_connection**](ConnectionsApi.md#get_connection) | **GET** /v1/connections/{connection_id} | Get connection [**get_table_profile**](ConnectionsApi.md#get_table_profile) | **GET** /v1/connections/{connection_id}/tables/{schema}/{table}/profile | Get table profile [**list_connections**](ConnectionsApi.md#list_connections) | **GET** /v1/connections | List connections +[**load_managed_table**](ConnectionsApi.md#load_managed_table) | **POST** /v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads | Load managed table from upload [**purge_connection_cache**](ConnectionsApi.md#purge_connection_cache) | **DELETE** /v1/connections/{connection_id}/cache | Purge connection cache [**purge_table_cache**](ConnectionsApi.md#purge_table_cache) | **DELETE** /v1/connections/{connection_id}/tables/{schema}/{table}/cache | Purge table cache @@ -271,6 +273,94 @@ 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) +# **delete_managed_table** +> delete_managed_table(connection_id, var_schema, table) + +Delete managed table + +Delete a single managed-catalog table. The catalog row is removed and the backing parquet file (if any) is scheduled for deletion. Only valid against connections whose source type is `managed`. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.hotdata.dev +# See configuration.py for a list of all supported configuration parameters. +configuration = hotdata.Configuration( + host = "https://api.hotdata.dev" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: WorkspaceId +configuration.api_key['WorkspaceId'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['WorkspaceId'] = 'Bearer' + +# Configure Bearer authorization: BearerAuth +configuration = hotdata.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with hotdata.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hotdata.ConnectionsApi(api_client) + connection_id = 'connection_id_example' # str | Connection ID + var_schema = 'var_schema_example' # str | Schema name + table = 'table_example' # str | Table name + + try: + # Delete managed table + api_instance.delete_managed_table(connection_id, var_schema, table) + except Exception as e: + print("Exception when calling ConnectionsApi->delete_managed_table: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **connection_id** | **str**| Connection ID | + **var_schema** | **str**| Schema name | + **table** | **str**| Table name | + +### Return type + +void (empty response body) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Managed table deleted | - | +**400** | Connection is not a managed catalog | - | +**404** | Connection or table not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_connection** > GetConnectionResponse get_connection(connection_id) @@ -528,6 +618,101 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **load_managed_table** +> LoadManagedTableResponse load_managed_table(connection_id, var_schema, table, load_managed_table_request) + +Load managed table from upload + +Publish a previously-uploaded parquet file as the new generation of a managed table. The upload must reference a parquet file (verified by magic bytes). Only `mode = "replace"` is supported. Concurrent loads against the same upload return 409. + +### Example + +* Api Key Authentication (WorkspaceId): +* Bearer Authentication (BearerAuth): + +```python +import hotdata +from hotdata.models.load_managed_table_request import LoadManagedTableRequest +from hotdata.models.load_managed_table_response import LoadManagedTableResponse +from hotdata.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.hotdata.dev +# See configuration.py for a list of all supported configuration parameters. +configuration = hotdata.Configuration( + host = "https://api.hotdata.dev" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: WorkspaceId +configuration.api_key['WorkspaceId'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['WorkspaceId'] = 'Bearer' + +# Configure Bearer authorization: BearerAuth +configuration = hotdata.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with hotdata.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hotdata.ConnectionsApi(api_client) + connection_id = 'connection_id_example' # str | Connection ID + var_schema = 'var_schema_example' # str | Schema name + table = 'table_example' # str | Table name + load_managed_table_request = hotdata.LoadManagedTableRequest() # LoadManagedTableRequest | + + try: + # Load managed table from upload + api_response = api_instance.load_managed_table(connection_id, var_schema, table, load_managed_table_request) + print("The response of ConnectionsApi->load_managed_table:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ConnectionsApi->load_managed_table: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **connection_id** | **str**| Connection ID | + **var_schema** | **str**| Schema name | + **table** | **str**| Table name | + **load_managed_table_request** | [**LoadManagedTableRequest**](LoadManagedTableRequest.md)| | + +### Return type + +[**LoadManagedTableResponse**](LoadManagedTableResponse.md) + +### Authorization + +[WorkspaceId](../README.md#WorkspaceId), [BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Managed table loaded | - | +**400** | Invalid request (bad mode, non-managed connection, bad parquet) | - | +**404** | Connection or upload not found | - | +**409** | Upload already consumed or in flight | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **purge_connection_cache** > purge_connection_cache(connection_id) diff --git a/docs/LoadManagedTableRequest.md b/docs/LoadManagedTableRequest.md new file mode 100644 index 0000000..08d5549 --- /dev/null +++ b/docs/LoadManagedTableRequest.md @@ -0,0 +1,31 @@ +# LoadManagedTableRequest + +Request body for `POST /v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads`. Publishes a previously-uploaded parquet file as the new generation for the named managed table. `mode` is fixed to `\"replace\"` today; the field is kept in the request body so future modes (e.g. append) are an additive change. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | **str** | Load mode. Only `\"replace\"` is supported in this release. | +**upload_id** | **str** | ID of a previously-staged upload (see `POST /v1/files`). The upload must reference a parquet file. The upload is claimed atomically; concurrent loads against the same `upload_id` return 409. | + +## Example + +```python +from hotdata.models.load_managed_table_request import LoadManagedTableRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of LoadManagedTableRequest from a JSON string +load_managed_table_request_instance = LoadManagedTableRequest.from_json(json) +# print the JSON string representation of the object +print(LoadManagedTableRequest.to_json()) + +# convert the object into a dict +load_managed_table_request_dict = load_managed_table_request_instance.to_dict() +# create an instance of LoadManagedTableRequest from a dict +load_managed_table_request_from_dict = LoadManagedTableRequest.from_dict(load_managed_table_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LoadManagedTableResponse.md b/docs/LoadManagedTableResponse.md new file mode 100644 index 0000000..0131cbc --- /dev/null +++ b/docs/LoadManagedTableResponse.md @@ -0,0 +1,34 @@ +# LoadManagedTableResponse + +Response body for `POST /v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrow_schema_json** | **str** | Arrow schema (JSON) parsed from the uploaded parquet footer. | +**connection_id** | **str** | | +**row_count** | **int** | Total rows in the published parquet file. | +**schema_name** | **str** | | +**table_name** | **str** | | + +## Example + +```python +from hotdata.models.load_managed_table_response import LoadManagedTableResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of LoadManagedTableResponse from a JSON string +load_managed_table_response_instance = LoadManagedTableResponse.from_json(json) +# print the JSON string representation of the object +print(LoadManagedTableResponse.to_json()) + +# convert the object into a dict +load_managed_table_response_dict = load_managed_table_response_instance.to_dict() +# create an instance of LoadManagedTableResponse from a dict +load_managed_table_response_from_dict = LoadManagedTableResponse.from_dict(load_managed_table_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/hotdata/__init__.py b/hotdata/__init__.py index eb05ec8..5481fe2 100644 --- a/hotdata/__init__.py +++ b/hotdata/__init__.py @@ -127,6 +127,8 @@ "ListUploadsResponse", "ListWorkspaceContextsResponse", "ListWorkspacesResponse", + "LoadManagedTableRequest", + "LoadManagedTableResponse", "NumericProfileDetail", "QueryRequest", "QueryResponse", @@ -280,6 +282,8 @@ from hotdata.models.list_uploads_response import ListUploadsResponse as ListUploadsResponse from hotdata.models.list_workspace_contexts_response import ListWorkspaceContextsResponse as ListWorkspaceContextsResponse from hotdata.models.list_workspaces_response import ListWorkspacesResponse as ListWorkspacesResponse +from hotdata.models.load_managed_table_request import LoadManagedTableRequest as LoadManagedTableRequest +from hotdata.models.load_managed_table_response import LoadManagedTableResponse as LoadManagedTableResponse from hotdata.models.numeric_profile_detail import NumericProfileDetail as NumericProfileDetail from hotdata.models.query_request import QueryRequest as QueryRequest from hotdata.models.query_response import QueryResponse as QueryResponse diff --git a/hotdata/api/connections_api.py b/hotdata/api/connections_api.py index 480dc30..9bc7afe 100644 --- a/hotdata/api/connections_api.py +++ b/hotdata/api/connections_api.py @@ -23,6 +23,8 @@ from hotdata.models.create_connection_response import CreateConnectionResponse from hotdata.models.get_connection_response import GetConnectionResponse from hotdata.models.list_connections_response import ListConnectionsResponse +from hotdata.models.load_managed_table_request import LoadManagedTableRequest +from hotdata.models.load_managed_table_response import LoadManagedTableResponse from hotdata.models.table_profile_response import TableProfileResponse from hotdata.api_client import ApiClient, RequestSerialized @@ -855,9 +857,11 @@ def _delete_connection_serialize( @validate_call - def get_connection( + def delete_managed_table( self, connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -870,13 +874,17 @@ def get_connection( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> GetConnectionResponse: - """Get connection + ) -> None: + """Delete managed table - Get details for a specific connection, including table and sync counts. + Delete a single managed-catalog table. The catalog row is removed and the backing parquet file (if any) is scheduled for deletion. Only valid against connections whose source type is `managed`. :param connection_id: Connection ID (required) :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: 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 @@ -899,8 +907,10 @@ def get_connection( :return: Returns the result object. """ # noqa: E501 - _param = self._get_connection_serialize( + _param = self._delete_managed_table_serialize( connection_id=connection_id, + var_schema=var_schema, + table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -908,7 +918,8 @@ def get_connection( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetConnectionResponse", + '204': None, + '400': "ApiErrorResponse", '404': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -923,9 +934,11 @@ def get_connection( @validate_call - def get_connection_with_http_info( + def delete_managed_table_with_http_info( self, connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -938,13 +951,17 @@ def get_connection_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[GetConnectionResponse]: - """Get connection + ) -> ApiResponse[None]: + """Delete managed table - Get details for a specific connection, including table and sync counts. + Delete a single managed-catalog table. The catalog row is removed and the backing parquet file (if any) is scheduled for deletion. Only valid against connections whose source type is `managed`. :param connection_id: Connection ID (required) :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: 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 @@ -967,8 +984,10 @@ def get_connection_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_connection_serialize( + _param = self._delete_managed_table_serialize( connection_id=connection_id, + var_schema=var_schema, + table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -976,7 +995,8 @@ def get_connection_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetConnectionResponse", + '204': None, + '400': "ApiErrorResponse", '404': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -991,9 +1011,11 @@ def get_connection_with_http_info( @validate_call - def get_connection_without_preload_content( + def delete_managed_table_without_preload_content( self, connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1007,12 +1029,16 @@ def get_connection_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get connection + """Delete managed table - Get details for a specific connection, including table and sync counts. + Delete a single managed-catalog table. The catalog row is removed and the backing parquet file (if any) is scheduled for deletion. Only valid against connections whose source type is `managed`. :param connection_id: Connection ID (required) :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: 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 @@ -1035,8 +1061,10 @@ def get_connection_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_connection_serialize( + _param = self._delete_managed_table_serialize( connection_id=connection_id, + var_schema=var_schema, + table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1044,7 +1072,8 @@ def get_connection_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetConnectionResponse", + '204': None, + '400': "ApiErrorResponse", '404': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -1054,9 +1083,11 @@ def get_connection_without_preload_content( return response_data.response - def _get_connection_serialize( + def _delete_managed_table_serialize( self, connection_id, + var_schema, + table, _request_auth, _content_type, _headers, @@ -1080,6 +1111,10 @@ def _get_connection_serialize( # 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 # process the query parameters # process the header parameters # process the form parameters @@ -1102,8 +1137,8 @@ def _get_connection_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/v1/connections/{connection_id}', + method='DELETE', + resource_path='/v1/connections/{connection_id}/schemas/{schema}/tables/{table}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1120,11 +1155,9 @@ def _get_connection_serialize( @validate_call - def get_table_profile( + def get_connection( self, connection_id: Annotated[StrictStr, Field(description="Connection ID")], - var_schema: Annotated[StrictStr, Field(description="Schema name")], - table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1137,17 +1170,13 @@ def get_table_profile( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> TableProfileResponse: - """Get table profile + ) -> GetConnectionResponse: + """Get connection - Get column-level statistics for a synced table. Returns per-column profiles including cardinality, null counts, and type-specific details (distinct values for categorical columns, min/max for temporal/numeric, length stats for text). Profiles are computed at sync time. + Get details for a specific connection, including table and sync counts. :param connection_id: Connection ID (required) :type connection_id: str - :param var_schema: Schema name (required) - :type var_schema: str - :param table: Table name (required) - :type table: 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 @@ -1170,10 +1199,8 @@ def get_table_profile( :return: Returns the result object. """ # noqa: E501 - _param = self._get_table_profile_serialize( + _param = self._get_connection_serialize( connection_id=connection_id, - var_schema=var_schema, - table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1181,7 +1208,7 @@ def get_table_profile( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TableProfileResponse", + '200': "GetConnectionResponse", '404': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -1196,11 +1223,9 @@ def get_table_profile( @validate_call - def get_table_profile_with_http_info( + def get_connection_with_http_info( self, connection_id: Annotated[StrictStr, Field(description="Connection ID")], - var_schema: Annotated[StrictStr, Field(description="Schema name")], - table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1213,17 +1238,13 @@ def get_table_profile_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[TableProfileResponse]: - """Get table profile + ) -> ApiResponse[GetConnectionResponse]: + """Get connection - Get column-level statistics for a synced table. Returns per-column profiles including cardinality, null counts, and type-specific details (distinct values for categorical columns, min/max for temporal/numeric, length stats for text). Profiles are computed at sync time. + Get details for a specific connection, including table and sync counts. :param connection_id: Connection ID (required) :type connection_id: str - :param var_schema: Schema name (required) - :type var_schema: str - :param table: Table name (required) - :type table: 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 @@ -1246,10 +1267,8 @@ def get_table_profile_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_table_profile_serialize( + _param = self._get_connection_serialize( connection_id=connection_id, - var_schema=var_schema, - table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1257,7 +1276,7 @@ def get_table_profile_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TableProfileResponse", + '200': "GetConnectionResponse", '404': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -1272,11 +1291,9 @@ def get_table_profile_with_http_info( @validate_call - def get_table_profile_without_preload_content( + def get_connection_without_preload_content( self, connection_id: Annotated[StrictStr, Field(description="Connection ID")], - var_schema: Annotated[StrictStr, Field(description="Schema name")], - table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1290,16 +1307,12 @@ def get_table_profile_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get table profile + """Get connection - Get column-level statistics for a synced table. Returns per-column profiles including cardinality, null counts, and type-specific details (distinct values for categorical columns, min/max for temporal/numeric, length stats for text). Profiles are computed at sync time. + Get details for a specific connection, including table and sync counts. :param connection_id: Connection ID (required) :type connection_id: str - :param var_schema: Schema name (required) - :type var_schema: str - :param table: Table name (required) - :type table: 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 @@ -1322,10 +1335,8 @@ def get_table_profile_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_table_profile_serialize( + _param = self._get_connection_serialize( connection_id=connection_id, - var_schema=var_schema, - table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1333,7 +1344,7 @@ def get_table_profile_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TableProfileResponse", + '200': "GetConnectionResponse", '404': "ApiErrorResponse", } response_data = self.api_client.call_api( @@ -1343,11 +1354,9 @@ def get_table_profile_without_preload_content( return response_data.response - def _get_table_profile_serialize( + def _get_connection_serialize( self, connection_id, - var_schema, - table, _request_auth, _content_type, _headers, @@ -1371,10 +1380,6 @@ def _get_table_profile_serialize( # 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 # process the query parameters # process the header parameters # process the form parameters @@ -1398,7 +1403,7 @@ def _get_table_profile_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v1/connections/{connection_id}/tables/{schema}/{table}/profile', + resource_path='/v1/connections/{connection_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1415,8 +1420,11 @@ def _get_table_profile_serialize( @validate_call - def list_connections( + def get_table_profile( self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1429,11 +1437,17 @@ def list_connections( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListConnectionsResponse: - """List connections + ) -> TableProfileResponse: + """Get table profile - List all registered database connections. + Get column-level statistics for a synced table. Returns per-column profiles including cardinality, null counts, and type-specific details (distinct values for categorical columns, min/max for temporal/numeric, length stats for text). Profiles are computed at sync time. + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: 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 @@ -1456,7 +1470,10 @@ def list_connections( :return: Returns the result object. """ # noqa: E501 - _param = self._list_connections_serialize( + _param = self._get_table_profile_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1464,7 +1481,8 @@ def list_connections( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ListConnectionsResponse", + '200': "TableProfileResponse", + '404': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -1478,8 +1496,11 @@ def list_connections( @validate_call - def list_connections_with_http_info( + def get_table_profile_with_http_info( self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1492,11 +1513,17 @@ def list_connections_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[ListConnectionsResponse]: - """List connections + ) -> ApiResponse[TableProfileResponse]: + """Get table profile - List all registered database connections. + Get column-level statistics for a synced table. Returns per-column profiles including cardinality, null counts, and type-specific details (distinct values for categorical columns, min/max for temporal/numeric, length stats for text). Profiles are computed at sync time. + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: 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 @@ -1519,7 +1546,10 @@ def list_connections_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_connections_serialize( + _param = self._get_table_profile_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1527,7 +1557,8 @@ def list_connections_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ListConnectionsResponse", + '200': "TableProfileResponse", + '404': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -1541,8 +1572,11 @@ def list_connections_with_http_info( @validate_call - def list_connections_without_preload_content( + def get_table_profile_without_preload_content( self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1556,10 +1590,16 @@ def list_connections_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List connections + """Get table profile - List all registered database connections. + Get column-level statistics for a synced table. Returns per-column profiles including cardinality, null counts, and type-specific details (distinct values for categorical columns, min/max for temporal/numeric, length stats for text). Profiles are computed at sync time. + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: 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 @@ -1582,7 +1622,10 @@ def list_connections_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_connections_serialize( + _param = self._get_table_profile_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1590,7 +1633,8 @@ def list_connections_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ListConnectionsResponse", + '200': "TableProfileResponse", + '404': "ApiErrorResponse", } response_data = self.api_client.call_api( *_param, @@ -1599,8 +1643,11 @@ def list_connections_without_preload_content( return response_data.response - def _list_connections_serialize( + def _get_table_profile_serialize( self, + connection_id, + var_schema, + table, _request_auth, _content_type, _headers, @@ -1622,6 +1669,12 @@ def _list_connections_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 # process the query parameters # process the header parameters # process the form parameters @@ -1645,7 +1698,583 @@ def _list_connections_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v1/connections', + resource_path='/v1/connections/{connection_id}/tables/{schema}/{table}/profile', + 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_connections( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListConnectionsResponse: + """List connections + + List all registered database connections. + + :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_connections_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConnectionsResponse", + } + 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_connections_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListConnectionsResponse]: + """List connections + + List all registered database connections. + + :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_connections_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConnectionsResponse", + } + 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_connections_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List connections + + List all registered database connections. + + :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_connections_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConnectionsResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_connections_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/connections', + 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 load_managed_table( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], + load_managed_table_request: LoadManagedTableRequest, + _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, + ) -> LoadManagedTableResponse: + """Load managed table from upload + + Publish a previously-uploaded parquet file as the new generation of a managed table. The upload must reference a parquet file (verified by magic bytes). Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: str + :param load_managed_table_request: (required) + :type load_managed_table_request: LoadManagedTableRequest + :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._load_managed_table_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, + load_managed_table_request=load_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LoadManagedTableResponse", + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def load_managed_table_with_http_info( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], + load_managed_table_request: LoadManagedTableRequest, + _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[LoadManagedTableResponse]: + """Load managed table from upload + + Publish a previously-uploaded parquet file as the new generation of a managed table. The upload must reference a parquet file (verified by magic bytes). Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: str + :param load_managed_table_request: (required) + :type load_managed_table_request: LoadManagedTableRequest + :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._load_managed_table_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, + load_managed_table_request=load_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LoadManagedTableResponse", + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def load_managed_table_without_preload_content( + self, + connection_id: Annotated[StrictStr, Field(description="Connection ID")], + var_schema: Annotated[StrictStr, Field(description="Schema name")], + table: Annotated[StrictStr, Field(description="Table name")], + load_managed_table_request: LoadManagedTableRequest, + _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: + """Load managed table from upload + + Publish a previously-uploaded parquet file as the new generation of a managed table. The upload must reference a parquet file (verified by magic bytes). Only `mode = \"replace\"` is supported. Concurrent loads against the same upload return 409. + + :param connection_id: Connection ID (required) + :type connection_id: str + :param var_schema: Schema name (required) + :type var_schema: str + :param table: Table name (required) + :type table: str + :param load_managed_table_request: (required) + :type load_managed_table_request: LoadManagedTableRequest + :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._load_managed_table_serialize( + connection_id=connection_id, + var_schema=var_schema, + table=table, + load_managed_table_request=load_managed_table_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LoadManagedTableResponse", + '400': "ApiErrorResponse", + '404': "ApiErrorResponse", + '409': "ApiErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _load_managed_table_serialize( + self, + connection_id, + var_schema, + table, + load_managed_table_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if connection_id is not None: + _path_params['connection_id'] = connection_id + if var_schema is not None: + _path_params['schema'] = var_schema + if table is not None: + _path_params['table'] = table + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if load_managed_table_request is not None: + _body_params = load_managed_table_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'WorkspaceId', + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/hotdata/models/__init__.py b/hotdata/models/__init__.py index 87966ce..90caa83 100644 --- a/hotdata/models/__init__.py +++ b/hotdata/models/__init__.py @@ -91,6 +91,8 @@ from hotdata.models.list_uploads_response import ListUploadsResponse from hotdata.models.list_workspace_contexts_response import ListWorkspaceContextsResponse from hotdata.models.list_workspaces_response import ListWorkspacesResponse +from hotdata.models.load_managed_table_request import LoadManagedTableRequest +from hotdata.models.load_managed_table_response import LoadManagedTableResponse from hotdata.models.numeric_profile_detail import NumericProfileDetail from hotdata.models.query_request import QueryRequest from hotdata.models.query_response import QueryResponse diff --git a/hotdata/models/load_managed_table_request.py b/hotdata/models/load_managed_table_request.py new file mode 100644 index 0000000..4e6461c --- /dev/null +++ b/hotdata/models/load_managed_table_request.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class LoadManagedTableRequest(BaseModel): + """ + Request body for `POST /v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads`. Publishes a previously-uploaded parquet file as the new generation for the named managed table. `mode` is fixed to `\"replace\"` today; the field is kept in the request body so future modes (e.g. append) are an additive change. + """ # noqa: E501 + mode: StrictStr = Field(description="Load mode. Only `\"replace\"` is supported in this release.") + upload_id: StrictStr = Field(description="ID of a previously-staged upload (see `POST /v1/files`). The upload must reference a parquet file. The upload is claimed atomically; concurrent loads against the same `upload_id` return 409.") + __properties: ClassVar[List[str]] = ["mode", "upload_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoadManagedTableRequest 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 LoadManagedTableRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mode": obj.get("mode"), + "upload_id": obj.get("upload_id") + }) + return _obj + + diff --git a/hotdata/models/load_managed_table_response.py b/hotdata/models/load_managed_table_response.py new file mode 100644 index 0000000..0d7d58f --- /dev/null +++ b/hotdata/models/load_managed_table_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class LoadManagedTableResponse(BaseModel): + """ + Response body for `POST /v1/connections/{connection_id}/schemas/{schema}/tables/{table}/loads`. + """ # noqa: E501 + arrow_schema_json: StrictStr = Field(description="Arrow schema (JSON) parsed from the uploaded parquet footer.") + connection_id: StrictStr + row_count: Annotated[int, Field(strict=True, ge=0)] = Field(description="Total rows in the published parquet file.") + schema_name: StrictStr + table_name: StrictStr + __properties: ClassVar[List[str]] = ["arrow_schema_json", "connection_id", "row_count", "schema_name", "table_name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoadManagedTableResponse 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 LoadManagedTableResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "arrow_schema_json": obj.get("arrow_schema_json"), + "connection_id": obj.get("connection_id"), + "row_count": obj.get("row_count"), + "schema_name": obj.get("schema_name"), + "table_name": obj.get("table_name") + }) + return _obj + + diff --git a/test/test_load_managed_table_request.py b/test/test_load_managed_table_request.py new file mode 100644 index 0000000..cfa2daf --- /dev/null +++ b/test/test_load_managed_table_request.py @@ -0,0 +1,55 @@ +# 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.load_managed_table_request import LoadManagedTableRequest + +class TestLoadManagedTableRequest(unittest.TestCase): + """LoadManagedTableRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> LoadManagedTableRequest: + """Test LoadManagedTableRequest + 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 `LoadManagedTableRequest` + """ + model = LoadManagedTableRequest() + if include_optional: + return LoadManagedTableRequest( + mode = '', + upload_id = '' + ) + else: + return LoadManagedTableRequest( + mode = '', + upload_id = '', + ) + """ + + def testLoadManagedTableRequest(self): + """Test LoadManagedTableRequest""" + # 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_load_managed_table_response.py b/test/test_load_managed_table_response.py new file mode 100644 index 0000000..2516a67 --- /dev/null +++ b/test/test_load_managed_table_response.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Hotdata API + + Powerful data platform API for datasets, queries, and analytics. + + The version of the OpenAPI document: 1.0.0 + Contact: developers@hotdata.dev + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from hotdata.models.load_managed_table_response import LoadManagedTableResponse + +class TestLoadManagedTableResponse(unittest.TestCase): + """LoadManagedTableResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> LoadManagedTableResponse: + """Test LoadManagedTableResponse + 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 `LoadManagedTableResponse` + """ + model = LoadManagedTableResponse() + if include_optional: + return LoadManagedTableResponse( + arrow_schema_json = '', + connection_id = '', + row_count = 0, + schema_name = '', + table_name = '' + ) + else: + return LoadManagedTableResponse( + arrow_schema_json = '', + connection_id = '', + row_count = 0, + schema_name = '', + table_name = '', + ) + """ + + def testLoadManagedTableResponse(self): + """Test LoadManagedTableResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()