Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 70
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-68653cfcdb9b0e0babd9318a6195cd254b667797de3b08f906d4b110521a68d6.yml
configured_endpoints: 69
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-32af43da943808884c287c71d5f8102df27b1bab84f86b8753ceb21517787c0d.yml
8 changes: 1 addition & 7 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,14 @@ Methods:
Types:

```python
from asktable.types.datasources import (
Meta,
MetaCreateResponse,
MetaUpdateResponse,
MetaDeleteResponse,
)
from asktable.types.datasources import Meta, MetaCreateResponse, MetaUpdateResponse
```

Methods:

- <code title="post /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">create</a>(datasource_id, \*\*<a href="src/asktable/types/datasources/meta_create_params.py">params</a>) -> <a href="./src/asktable/types/datasources/meta_create_response.py">object</a></code>
- <code title="get /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">retrieve</a>(datasource_id) -> <a href="./src/asktable/types/datasources/meta.py">Meta</a></code>
- <code title="put /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">update</a>(datasource_id, \*\*<a href="src/asktable/types/datasources/meta_update_params.py">params</a>) -> <a href="./src/asktable/types/datasources/meta_update_response.py">object</a></code>
- <code title="delete /datasources/{datasource_id}/meta">client.datasources.meta.<a href="./src/asktable/resources/datasources/meta.py">delete</a>(datasource_id) -> <a href="./src/asktable/types/datasources/meta_delete_response.py">object</a></code>

## UploadParams

Expand Down
6 changes: 2 additions & 4 deletions src/asktable/resources/datasources/datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ def update(
desc: Optional[str] | NotGiven = NOT_GIVEN,
field_count: Optional[int] | NotGiven = NOT_GIVEN,
meta_error: Optional[str] | NotGiven = NOT_GIVEN,
meta_status: Optional[Literal["processing", "failed", "warning", "success", "unprocessed"]]
| NotGiven = NOT_GIVEN,
meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
sample_questions: Optional[str] | NotGiven = NOT_GIVEN,
schema_count: Optional[int] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -497,8 +496,7 @@ async def update(
desc: Optional[str] | NotGiven = NOT_GIVEN,
field_count: Optional[int] | NotGiven = NOT_GIVEN,
meta_error: Optional[str] | NotGiven = NOT_GIVEN,
meta_status: Optional[Literal["processing", "failed", "warning", "success", "unprocessed"]]
| NotGiven = NOT_GIVEN,
meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
sample_questions: Optional[str] | NotGiven = NOT_GIVEN,
schema_count: Optional[int] | NotGiven = NOT_GIVEN,
Expand Down
86 changes: 4 additions & 82 deletions src/asktable/resources/datasources/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
"""
创建或刷新 数据源的 meta
创建数据源的 meta,如果已经存在,则删除旧的

如果上传了 meta,则使用用户上传的数据创建。

Expand Down Expand Up @@ -96,7 +96,7 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
"""
创建或刷新 数据源的 meta
创建数据源的 meta,如果已经存在,则删除旧的

如果上传了 meta,则使用用户上传的数据创建。

Expand Down Expand Up @@ -269,39 +269,6 @@ def update(
cast_to=object,
)

def delete(
self,
datasource_id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
"""
Delete Datasource Metadata

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return self._delete(
f"/datasources/{datasource_id}/meta",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=object,
)


class AsyncMetaResource(AsyncAPIResource):
@cached_property
Expand Down Expand Up @@ -338,7 +305,7 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
"""
创建或刷新 数据源的 meta
创建数据源的 meta,如果已经存在,则删除旧的

如果上传了 meta,则使用用户上传的数据创建。

Expand Down Expand Up @@ -371,7 +338,7 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
"""
创建或刷新 数据源的 meta
创建数据源的 meta,如果已经存在,则删除旧的

如果上传了 meta,则使用用户上传的数据创建。

Expand Down Expand Up @@ -544,39 +511,6 @@ async def update(
cast_to=object,
)

async def delete(
self,
datasource_id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
"""
Delete Datasource Metadata

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not datasource_id:
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
return await self._delete(
f"/datasources/{datasource_id}/meta",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=object,
)


class MetaResourceWithRawResponse:
def __init__(self, meta: MetaResource) -> None:
Expand All @@ -591,9 +525,6 @@ def __init__(self, meta: MetaResource) -> None:
self.update = to_raw_response_wrapper(
meta.update,
)
self.delete = to_raw_response_wrapper(
meta.delete,
)


class AsyncMetaResourceWithRawResponse:
Expand All @@ -609,9 +540,6 @@ def __init__(self, meta: AsyncMetaResource) -> None:
self.update = async_to_raw_response_wrapper(
meta.update,
)
self.delete = async_to_raw_response_wrapper(
meta.delete,
)


class MetaResourceWithStreamingResponse:
Expand All @@ -627,9 +555,6 @@ def __init__(self, meta: MetaResource) -> None:
self.update = to_streamed_response_wrapper(
meta.update,
)
self.delete = to_streamed_response_wrapper(
meta.delete,
)


class AsyncMetaResourceWithStreamingResponse:
Expand All @@ -645,6 +570,3 @@ def __init__(self, meta: AsyncMetaResource) -> None:
self.update = async_to_streamed_response_wrapper(
meta.update,
)
self.delete = async_to_streamed_response_wrapper(
meta.delete,
)
2 changes: 1 addition & 1 deletion src/asktable/types/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DataSource(BaseModel):
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"]
"""数据源引擎"""

meta_status: Literal["processing", "failed", "warning", "success", "unprocessed"]
meta_status: Literal["processing", "failed", "success", "unprocessed"]
"""元数据处理状态"""

modified_at: datetime
Expand Down
2 changes: 1 addition & 1 deletion src/asktable/types/datasource_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DatasourceUpdateParams(TypedDict, total=False):
meta_error: Optional[str]
"""元数据处理错误"""

meta_status: Optional[Literal["processing", "failed", "warning", "success", "unprocessed"]]
meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]]
"""元数据处理状态"""

name: Optional[str]
Expand Down
76 changes: 0 additions & 76 deletions tests/api_resources/datasources/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,44 +281,6 @@ def test_path_params_update_overload_2(self, client: Asktable) -> None:
body=None,
)

@parametrize
def test_method_delete(self, client: Asktable) -> None:
meta = client.datasources.meta.delete(
"datasource_id",
)
assert_matches_type(object, meta, path=["response"])

@parametrize
def test_raw_response_delete(self, client: Asktable) -> None:
response = client.datasources.meta.with_raw_response.delete(
"datasource_id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
meta = response.parse()
assert_matches_type(object, meta, path=["response"])

@parametrize
def test_streaming_response_delete(self, client: Asktable) -> None:
with client.datasources.meta.with_streaming_response.delete(
"datasource_id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

meta = response.parse()
assert_matches_type(object, meta, path=["response"])

assert cast(Any, response.is_closed) is True

@parametrize
def test_path_params_delete(self, client: Asktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
client.datasources.meta.with_raw_response.delete(
"",
)


class TestAsyncMeta:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
Expand Down Expand Up @@ -586,41 +548,3 @@ async def test_path_params_update_overload_2(self, async_client: AsyncAsktable)
datasource_id="",
body=None,
)

@parametrize
async def test_method_delete(self, async_client: AsyncAsktable) -> None:
meta = await async_client.datasources.meta.delete(
"datasource_id",
)
assert_matches_type(object, meta, path=["response"])

@parametrize
async def test_raw_response_delete(self, async_client: AsyncAsktable) -> None:
response = await async_client.datasources.meta.with_raw_response.delete(
"datasource_id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
meta = await response.parse()
assert_matches_type(object, meta, path=["response"])

@parametrize
async def test_streaming_response_delete(self, async_client: AsyncAsktable) -> None:
async with async_client.datasources.meta.with_streaming_response.delete(
"datasource_id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

meta = await response.parse()
assert_matches_type(object, meta, path=["response"])

assert cast(Any, response.is_closed) is True

@parametrize
async def test_path_params_delete(self, async_client: AsyncAsktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
await async_client.datasources.meta.with_raw_response.delete(
"",
)