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: 82
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-4bee800ad604492e6ee5776c10e1668037755aeaae6ff6faa2d09a0c3763eeee.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9cb2534e1d18be02424ad6c8b5843957658c9cf1a42ced4ba6fc177c9843df50.yml
4 changes: 2 additions & 2 deletions src/asktable/resources/datasources/datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def with_streaming_response(self) -> DatasourcesResourceWithStreamingResponse:
def create(
self,
*,
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"],
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"],
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -428,7 +428,7 @@ def with_streaming_response(self) -> AsyncDatasourcesResourceWithStreamingRespon
async def create(
self,
*,
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"],
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"],
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,
Expand Down
20 changes: 10 additions & 10 deletions src/asktable/resources/securetunnels.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def with_streaming_response(self) -> SecuretunnelsResourceWithStreamingResponse:
def create(
self,
*,
name: Optional[str] | NotGiven = NOT_GIVEN,
name: 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,
Expand Down Expand Up @@ -124,8 +124,8 @@ def update(
self,
securetunnel_id: str,
*,
name: str,
client_info: Optional[object] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
unique_key: Optional[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.
Expand All @@ -138,10 +138,10 @@ def update(
更新某个 ATST

Args:
client_info: 客户端信息

name: SecureTunnel 名称,不超过 20 个字符

client_info: 客户端信息

unique_key: 唯一标识,用于更新客户端信息(容器 ID)

extra_headers: Send extra headers
Expand All @@ -158,8 +158,8 @@ def update(
f"/securetunnels/{securetunnel_id}",
body=maybe_transform(
{
"client_info": client_info,
"name": name,
"client_info": client_info,
"unique_key": unique_key,
},
securetunnel_update_params.SecuretunnelUpdateParams,
Expand Down Expand Up @@ -325,7 +325,7 @@ def with_streaming_response(self) -> AsyncSecuretunnelsResourceWithStreamingResp
async def create(
self,
*,
name: Optional[str] | NotGiven = NOT_GIVEN,
name: 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,
Expand Down Expand Up @@ -393,8 +393,8 @@ async def update(
self,
securetunnel_id: str,
*,
name: str,
client_info: Optional[object] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
unique_key: Optional[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.
Expand All @@ -407,10 +407,10 @@ async def update(
更新某个 ATST

Args:
client_info: 客户端信息

name: SecureTunnel 名称,不超过 20 个字符

client_info: 客户端信息

unique_key: 唯一标识,用于更新客户端信息(容器 ID)

extra_headers: Send extra headers
Expand All @@ -427,8 +427,8 @@ async def update(
f"/securetunnels/{securetunnel_id}",
body=await async_maybe_transform(
{
"client_info": client_info,
"name": name,
"client_info": client_info,
"unique_key": unique_key,
},
securetunnel_update_params.SecuretunnelUpdateParams,
Expand Down
2 changes: 1 addition & 1 deletion src/asktable/types/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Datasource(BaseModel):
created_at: datetime
"""创建时间"""

engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"]
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"]
"""数据源引擎"""

meta_status: Literal["processing", "failed", "success", "unprocessed"]
Expand Down
4 changes: 3 additions & 1 deletion src/asktable/types/datasource_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@


class DatasourceCreateParams(TypedDict, total=False):
engine: Required[Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"]]
engine: Required[
Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"]
]
"""数据源引擎"""

async_process_meta: bool
Expand Down
1 change: 1 addition & 0 deletions src/asktable/types/secure_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SecureTunnel(BaseModel):
modified_at: datetime

name: str
"""SecureTunnel 名称,不超过 20 个字符"""

project_id: str

Expand Down
5 changes: 2 additions & 3 deletions src/asktable/types/securetunnel_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

from __future__ import annotations

from typing import Optional
from typing_extensions import TypedDict
from typing_extensions import Required, TypedDict

__all__ = ["SecuretunnelCreateParams"]


class SecuretunnelCreateParams(TypedDict, total=False):
name: Optional[str]
name: Required[str]
"""SecureTunnel 名称,不超过 20 个字符"""
8 changes: 4 additions & 4 deletions src/asktable/types/securetunnel_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from __future__ import annotations

from typing import Optional
from typing_extensions import TypedDict
from typing_extensions import Required, TypedDict

__all__ = ["SecuretunnelUpdateParams"]


class SecuretunnelUpdateParams(TypedDict, total=False):
name: Required[str]
"""SecureTunnel 名称,不超过 20 个字符"""

client_info: Optional[object]
"""客户端信息"""

name: Optional[str]
"""SecureTunnel 名称,不超过 20 个字符"""

unique_key: Optional[str]
"""唯一标识,用于更新客户端信息(容器 ID)"""
38 changes: 22 additions & 16 deletions tests/api_resources/test_securetunnels.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@ class TestSecuretunnels:

@parametrize
def test_method_create(self, client: Asktable) -> None:
securetunnel = client.securetunnels.create()
assert_matches_type(SecureTunnel, securetunnel, path=["response"])

@parametrize
def test_method_create_with_all_params(self, client: Asktable) -> None:
securetunnel = client.securetunnels.create(
name="我的测试机",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])

@parametrize
def test_raw_response_create(self, client: Asktable) -> None:
response = client.securetunnels.with_raw_response.create()
response = client.securetunnels.with_raw_response.create(
name="我的测试机",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -44,7 +41,9 @@ def test_raw_response_create(self, client: Asktable) -> None:

@parametrize
def test_streaming_response_create(self, client: Asktable) -> None:
with client.securetunnels.with_streaming_response.create() as response:
with client.securetunnels.with_streaming_response.create(
name="我的测试机",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

Expand Down Expand Up @@ -95,15 +94,16 @@ def test_path_params_retrieve(self, client: Asktable) -> None:
def test_method_update(self, client: Asktable) -> None:
securetunnel = client.securetunnels.update(
securetunnel_id="securetunnel_id",
name="我的测试机",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])

@parametrize
def test_method_update_with_all_params(self, client: Asktable) -> None:
securetunnel = client.securetunnels.update(
securetunnel_id="securetunnel_id",
client_info={},
name="我的测试机",
client_info={},
unique_key="unique_key",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
Expand All @@ -112,6 +112,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None:
def test_raw_response_update(self, client: Asktable) -> None:
response = client.securetunnels.with_raw_response.update(
securetunnel_id="securetunnel_id",
name="我的测试机",
)

assert response.is_closed is True
Expand All @@ -123,6 +124,7 @@ def test_raw_response_update(self, client: Asktable) -> None:
def test_streaming_response_update(self, client: Asktable) -> None:
with client.securetunnels.with_streaming_response.update(
securetunnel_id="securetunnel_id",
name="我的测试机",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -137,6 +139,7 @@ def test_path_params_update(self, client: Asktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `securetunnel_id` but received ''"):
client.securetunnels.with_raw_response.update(
securetunnel_id="",
name="我的测试机",
)

@parametrize
Expand Down Expand Up @@ -263,19 +266,16 @@ class TestAsyncSecuretunnels:

@parametrize
async def test_method_create(self, async_client: AsyncAsktable) -> None:
securetunnel = await async_client.securetunnels.create()
assert_matches_type(SecureTunnel, securetunnel, path=["response"])

@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None:
securetunnel = await async_client.securetunnels.create(
name="我的测试机",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])

@parametrize
async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
response = await async_client.securetunnels.with_raw_response.create()
response = await async_client.securetunnels.with_raw_response.create(
name="我的测试机",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -284,7 +284,9 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:

@parametrize
async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
async with async_client.securetunnels.with_streaming_response.create() as response:
async with async_client.securetunnels.with_streaming_response.create(
name="我的测试机",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

Expand Down Expand Up @@ -335,15 +337,16 @@ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None:
async def test_method_update(self, async_client: AsyncAsktable) -> None:
securetunnel = await async_client.securetunnels.update(
securetunnel_id="securetunnel_id",
name="我的测试机",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])

@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncAsktable) -> None:
securetunnel = await async_client.securetunnels.update(
securetunnel_id="securetunnel_id",
client_info={},
name="我的测试机",
client_info={},
unique_key="unique_key",
)
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
Expand All @@ -352,6 +355,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable)
async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
response = await async_client.securetunnels.with_raw_response.update(
securetunnel_id="securetunnel_id",
name="我的测试机",
)

assert response.is_closed is True
Expand All @@ -363,6 +367,7 @@ async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
async def test_streaming_response_update(self, async_client: AsyncAsktable) -> None:
async with async_client.securetunnels.with_streaming_response.update(
securetunnel_id="securetunnel_id",
name="我的测试机",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -377,6 +382,7 @@ async def test_path_params_update(self, async_client: AsyncAsktable) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `securetunnel_id` but received ''"):
await async_client.securetunnels.with_raw_response.update(
securetunnel_id="",
name="我的测试机",
)

@parametrize
Expand Down