Skip to content

Commit 0d6f65d

Browse files
feat(api): api update (#39)
1 parent 1146de4 commit 0d6f65d

File tree

7 files changed

+11
-173
lines changed

7 files changed

+11
-173
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 70
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-68653cfcdb9b0e0babd9318a6195cd254b667797de3b08f906d4b110521a68d6.yml
1+
configured_endpoints: 69
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-32af43da943808884c287c71d5f8102df27b1bab84f86b8753ceb21517787c0d.yml

api.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,14 @@ Methods:
139139
Types:
140140

141141
```python
142-
from asktable.types.datasources import (
143-
Meta,
144-
MetaCreateResponse,
145-
MetaUpdateResponse,
146-
MetaDeleteResponse,
147-
)
142+
from asktable.types.datasources import Meta, MetaCreateResponse, MetaUpdateResponse
148143
```
149144

150145
Methods:
151146

152147
- <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>
153148
- <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>
154149
- <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>
155-
- <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>
156150

157151
## UploadParams
158152

src/asktable/resources/datasources/datasources.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ def update(
174174
desc: Optional[str] | NotGiven = NOT_GIVEN,
175175
field_count: Optional[int] | NotGiven = NOT_GIVEN,
176176
meta_error: Optional[str] | NotGiven = NOT_GIVEN,
177-
meta_status: Optional[Literal["processing", "failed", "warning", "success", "unprocessed"]]
178-
| NotGiven = NOT_GIVEN,
177+
meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | NotGiven = NOT_GIVEN,
179178
name: Optional[str] | NotGiven = NOT_GIVEN,
180179
sample_questions: Optional[str] | NotGiven = NOT_GIVEN,
181180
schema_count: Optional[int] | NotGiven = NOT_GIVEN,
@@ -497,8 +496,7 @@ async def update(
497496
desc: Optional[str] | NotGiven = NOT_GIVEN,
498497
field_count: Optional[int] | NotGiven = NOT_GIVEN,
499498
meta_error: Optional[str] | NotGiven = NOT_GIVEN,
500-
meta_status: Optional[Literal["processing", "failed", "warning", "success", "unprocessed"]]
501-
| NotGiven = NOT_GIVEN,
499+
meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | NotGiven = NOT_GIVEN,
502500
name: Optional[str] | NotGiven = NOT_GIVEN,
503501
sample_questions: Optional[str] | NotGiven = NOT_GIVEN,
504502
schema_count: Optional[int] | NotGiven = NOT_GIVEN,

src/asktable/resources/datasources/meta.py

Lines changed: 4 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def create(
6363
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
6464
) -> object:
6565
"""
66-
创建或刷新 数据源的 meta
66+
创建数据源的 meta,如果已经存在,则删除旧的
6767
6868
如果上传了 meta,则使用用户上传的数据创建。
6969
@@ -96,7 +96,7 @@ def create(
9696
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
9797
) -> object:
9898
"""
99-
创建或刷新 数据源的 meta
99+
创建数据源的 meta,如果已经存在,则删除旧的
100100
101101
如果上传了 meta,则使用用户上传的数据创建。
102102
@@ -269,39 +269,6 @@ def update(
269269
cast_to=object,
270270
)
271271

272-
def delete(
273-
self,
274-
datasource_id: str,
275-
*,
276-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
277-
# The extra values given here take precedence over values defined on the client or passed to this method.
278-
extra_headers: Headers | None = None,
279-
extra_query: Query | None = None,
280-
extra_body: Body | None = None,
281-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
282-
) -> object:
283-
"""
284-
Delete Datasource Metadata
285-
286-
Args:
287-
extra_headers: Send extra headers
288-
289-
extra_query: Add additional query parameters to the request
290-
291-
extra_body: Add additional JSON properties to the request
292-
293-
timeout: Override the client-level default timeout for this request, in seconds
294-
"""
295-
if not datasource_id:
296-
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
297-
return self._delete(
298-
f"/datasources/{datasource_id}/meta",
299-
options=make_request_options(
300-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
301-
),
302-
cast_to=object,
303-
)
304-
305272

306273
class AsyncMetaResource(AsyncAPIResource):
307274
@cached_property
@@ -338,7 +305,7 @@ async def create(
338305
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
339306
) -> object:
340307
"""
341-
创建或刷新 数据源的 meta
308+
创建数据源的 meta,如果已经存在,则删除旧的
342309
343310
如果上传了 meta,则使用用户上传的数据创建。
344311
@@ -371,7 +338,7 @@ async def create(
371338
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
372339
) -> object:
373340
"""
374-
创建或刷新 数据源的 meta
341+
创建数据源的 meta,如果已经存在,则删除旧的
375342
376343
如果上传了 meta,则使用用户上传的数据创建。
377344
@@ -544,39 +511,6 @@ async def update(
544511
cast_to=object,
545512
)
546513

547-
async def delete(
548-
self,
549-
datasource_id: str,
550-
*,
551-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
552-
# The extra values given here take precedence over values defined on the client or passed to this method.
553-
extra_headers: Headers | None = None,
554-
extra_query: Query | None = None,
555-
extra_body: Body | None = None,
556-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
557-
) -> object:
558-
"""
559-
Delete Datasource Metadata
560-
561-
Args:
562-
extra_headers: Send extra headers
563-
564-
extra_query: Add additional query parameters to the request
565-
566-
extra_body: Add additional JSON properties to the request
567-
568-
timeout: Override the client-level default timeout for this request, in seconds
569-
"""
570-
if not datasource_id:
571-
raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}")
572-
return await self._delete(
573-
f"/datasources/{datasource_id}/meta",
574-
options=make_request_options(
575-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
576-
),
577-
cast_to=object,
578-
)
579-
580514

581515
class MetaResourceWithRawResponse:
582516
def __init__(self, meta: MetaResource) -> None:
@@ -591,9 +525,6 @@ def __init__(self, meta: MetaResource) -> None:
591525
self.update = to_raw_response_wrapper(
592526
meta.update,
593527
)
594-
self.delete = to_raw_response_wrapper(
595-
meta.delete,
596-
)
597528

598529

599530
class AsyncMetaResourceWithRawResponse:
@@ -609,9 +540,6 @@ def __init__(self, meta: AsyncMetaResource) -> None:
609540
self.update = async_to_raw_response_wrapper(
610541
meta.update,
611542
)
612-
self.delete = async_to_raw_response_wrapper(
613-
meta.delete,
614-
)
615543

616544

617545
class MetaResourceWithStreamingResponse:
@@ -627,9 +555,6 @@ def __init__(self, meta: MetaResource) -> None:
627555
self.update = to_streamed_response_wrapper(
628556
meta.update,
629557
)
630-
self.delete = to_streamed_response_wrapper(
631-
meta.delete,
632-
)
633558

634559

635560
class AsyncMetaResourceWithStreamingResponse:
@@ -645,6 +570,3 @@ def __init__(self, meta: AsyncMetaResource) -> None:
645570
self.update = async_to_streamed_response_wrapper(
646571
meta.update,
647572
)
648-
self.delete = async_to_streamed_response_wrapper(
649-
meta.delete,
650-
)

src/asktable/types/data_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DataSource(BaseModel):
5151
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"]
5252
"""数据源引擎"""
5353

54-
meta_status: Literal["processing", "failed", "warning", "success", "unprocessed"]
54+
meta_status: Literal["processing", "failed", "success", "unprocessed"]
5555
"""元数据处理状态"""
5656

5757
modified_at: datetime

src/asktable/types/datasource_update_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class DatasourceUpdateParams(TypedDict, total=False):
2121
meta_error: Optional[str]
2222
"""元数据处理错误"""
2323

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

2727
name: Optional[str]

tests/api_resources/datasources/test_meta.py

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -281,44 +281,6 @@ def test_path_params_update_overload_2(self, client: Asktable) -> None:
281281
body=None,
282282
)
283283

284-
@parametrize
285-
def test_method_delete(self, client: Asktable) -> None:
286-
meta = client.datasources.meta.delete(
287-
"datasource_id",
288-
)
289-
assert_matches_type(object, meta, path=["response"])
290-
291-
@parametrize
292-
def test_raw_response_delete(self, client: Asktable) -> None:
293-
response = client.datasources.meta.with_raw_response.delete(
294-
"datasource_id",
295-
)
296-
297-
assert response.is_closed is True
298-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
299-
meta = response.parse()
300-
assert_matches_type(object, meta, path=["response"])
301-
302-
@parametrize
303-
def test_streaming_response_delete(self, client: Asktable) -> None:
304-
with client.datasources.meta.with_streaming_response.delete(
305-
"datasource_id",
306-
) as response:
307-
assert not response.is_closed
308-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
309-
310-
meta = response.parse()
311-
assert_matches_type(object, meta, path=["response"])
312-
313-
assert cast(Any, response.is_closed) is True
314-
315-
@parametrize
316-
def test_path_params_delete(self, client: Asktable) -> None:
317-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
318-
client.datasources.meta.with_raw_response.delete(
319-
"",
320-
)
321-
322284

323285
class TestAsyncMeta:
324286
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -586,41 +548,3 @@ async def test_path_params_update_overload_2(self, async_client: AsyncAsktable)
586548
datasource_id="",
587549
body=None,
588550
)
589-
590-
@parametrize
591-
async def test_method_delete(self, async_client: AsyncAsktable) -> None:
592-
meta = await async_client.datasources.meta.delete(
593-
"datasource_id",
594-
)
595-
assert_matches_type(object, meta, path=["response"])
596-
597-
@parametrize
598-
async def test_raw_response_delete(self, async_client: AsyncAsktable) -> None:
599-
response = await async_client.datasources.meta.with_raw_response.delete(
600-
"datasource_id",
601-
)
602-
603-
assert response.is_closed is True
604-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
605-
meta = await response.parse()
606-
assert_matches_type(object, meta, path=["response"])
607-
608-
@parametrize
609-
async def test_streaming_response_delete(self, async_client: AsyncAsktable) -> None:
610-
async with async_client.datasources.meta.with_streaming_response.delete(
611-
"datasource_id",
612-
) as response:
613-
assert not response.is_closed
614-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
615-
616-
meta = await response.parse()
617-
assert_matches_type(object, meta, path=["response"])
618-
619-
assert cast(Any, response.is_closed) is True
620-
621-
@parametrize
622-
async def test_path_params_delete(self, async_client: AsyncAsktable) -> None:
623-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"):
624-
await async_client.datasources.meta.with_raw_response.delete(
625-
"",
626-
)

0 commit comments

Comments
 (0)