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
2 changes: 1 addition & 1 deletion .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-a4263ca5de8cc8a3299535d391d72b3d1fbe13b2e20e351c9d6eac94f2a6df17.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-66a7fb2832b4895a6ee91a39040f6fcc3943bb1502c2a28e9788e1907942b60c.yml
16 changes: 12 additions & 4 deletions src/asktable/resources/datasources/datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def update(
datasource_id: str,
*,
access_config: Optional[datasource_update_params.AccessConfig] | NotGiven = NOT_GIVEN,
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"]]
Expand All @@ -192,6 +193,8 @@ def update(
Args:
access_config: 不同引擎有不同的配置

desc: 数据源描述

field_count: 字段数量

meta_error: 元数据处理错误
Expand Down Expand Up @@ -221,6 +224,7 @@ def update(
body=maybe_transform(
{
"access_config": access_config,
"desc": desc,
"field_count": field_count,
"meta_error": meta_error,
"meta_status": meta_status,
Expand Down Expand Up @@ -321,9 +325,9 @@ def delete(
def create_from_file(
self,
*,
name: str,
file: FileTypes,
async_process_meta: bool | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
# 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,
Expand Down Expand Up @@ -360,8 +364,8 @@ def create_from_file(
timeout=timeout,
query=maybe_transform(
{
"name": name,
"async_process_meta": async_process_meta,
"name": name,
},
datasource_create_from_file_params.DatasourceCreateFromFileParams,
),
Expand Down Expand Up @@ -490,6 +494,7 @@ async def update(
datasource_id: str,
*,
access_config: Optional[datasource_update_params.AccessConfig] | NotGiven = NOT_GIVEN,
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"]]
Expand All @@ -511,6 +516,8 @@ async def update(
Args:
access_config: 不同引擎有不同的配置

desc: 数据源描述

field_count: 字段数量

meta_error: 元数据处理错误
Expand Down Expand Up @@ -540,6 +547,7 @@ async def update(
body=await async_maybe_transform(
{
"access_config": access_config,
"desc": desc,
"field_count": field_count,
"meta_error": meta_error,
"meta_status": meta_status,
Expand Down Expand Up @@ -640,9 +648,9 @@ async def delete(
async def create_from_file(
self,
*,
name: str,
file: FileTypes,
async_process_meta: bool | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
# 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,
Expand Down Expand Up @@ -679,8 +687,8 @@ async def create_from_file(
timeout=timeout,
query=await async_maybe_transform(
{
"name": name,
"async_process_meta": async_process_meta,
"name": name,
},
datasource_create_from_file_params.DatasourceCreateFromFileParams,
),
Expand Down
3 changes: 3 additions & 0 deletions src/asktable/types/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class DataSource(BaseModel):
access_config: Optional[AccessConfig] = None
"""访问数据源的配置信息"""

desc: Optional[str] = None
"""数据源描述"""

field_count: Optional[int] = None
"""字段数量"""

Expand Down
4 changes: 2 additions & 2 deletions src/asktable/types/datasource_create_from_file_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@


class DatasourceCreateFromFileParams(TypedDict, total=False):
name: Required[str]

file: Required[FileTypes]

async_process_meta: bool

name: str
3 changes: 3 additions & 0 deletions src/asktable/types/datasource_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class DatasourceUpdateParams(TypedDict, total=False):
access_config: Optional[AccessConfig]
"""不同引擎有不同的配置"""

desc: Optional[str]
"""数据源描述"""

field_count: Optional[int]
"""字段数量"""

Expand Down
12 changes: 4 additions & 8 deletions tests/api_resources/test_datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None:
"securetunnel_id": "atst_123456",
"user": "root",
},
desc="数据源描述",
field_count=1,
meta_error="error message",
meta_status="processing",
Expand Down Expand Up @@ -251,24 +252,22 @@ def test_path_params_delete(self, client: Asktable) -> None:
@parametrize
def test_method_create_from_file(self, client: Asktable) -> None:
datasource = client.datasources.create_from_file(
name="name",
file=b"raw file contents",
)
assert_matches_type(DataSource, datasource, path=["response"])

@parametrize
def test_method_create_from_file_with_all_params(self, client: Asktable) -> None:
datasource = client.datasources.create_from_file(
name="name",
file=b"raw file contents",
async_process_meta=True,
name="name",
)
assert_matches_type(DataSource, datasource, path=["response"])

@parametrize
def test_raw_response_create_from_file(self, client: Asktable) -> None:
response = client.datasources.with_raw_response.create_from_file(
name="name",
file=b"raw file contents",
)

Expand All @@ -280,7 +279,6 @@ def test_raw_response_create_from_file(self, client: Asktable) -> None:
@parametrize
def test_streaming_response_create_from_file(self, client: Asktable) -> None:
with client.datasources.with_streaming_response.create_from_file(
name="name",
file=b"raw file contents",
) as response:
assert not response.is_closed
Expand Down Expand Up @@ -410,6 +408,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable)
"securetunnel_id": "atst_123456",
"user": "root",
},
desc="数据源描述",
field_count=1,
meta_error="error message",
meta_status="processing",
Expand Down Expand Up @@ -526,24 +525,22 @@ async def test_path_params_delete(self, async_client: AsyncAsktable) -> None:
@parametrize
async def test_method_create_from_file(self, async_client: AsyncAsktable) -> None:
datasource = await async_client.datasources.create_from_file(
name="name",
file=b"raw file contents",
)
assert_matches_type(DataSource, datasource, path=["response"])

@parametrize
async def test_method_create_from_file_with_all_params(self, async_client: AsyncAsktable) -> None:
datasource = await async_client.datasources.create_from_file(
name="name",
file=b"raw file contents",
async_process_meta=True,
name="name",
)
assert_matches_type(DataSource, datasource, path=["response"])

@parametrize
async def test_raw_response_create_from_file(self, async_client: AsyncAsktable) -> None:
response = await async_client.datasources.with_raw_response.create_from_file(
name="name",
file=b"raw file contents",
)

Expand All @@ -555,7 +552,6 @@ async def test_raw_response_create_from_file(self, async_client: AsyncAsktable)
@parametrize
async def test_streaming_response_create_from_file(self, async_client: AsyncAsktable) -> None:
async with async_client.datasources.with_streaming_response.create_from_file(
name="name",
file=b"raw file contents",
) as response:
assert not response.is_closed
Expand Down