Skip to content

Commit 558ab83

Browse files
feat(api): api update
1 parent 07d802a commit 558ab83

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 96
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-0d2c202b105ede34bc28a2532b7ff64cfb703b35a0e4ac110c663308f3db2ac5.yml
3-
openapi_spec_hash: 144caed1d3c1d1d2dd4af71dcb80ca2d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a1d971d9b78dce18435845fd9ff02282e95647ffee9b7406fb5f5cd0078c630b.yml
3+
openapi_spec_hash: ca7ca362f716b3a9b065f74f14ba43bc
44
config_hash: a572ab842ea60ce13f1d1a1358440cbe

src/asktable/resources/sqls.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def create(
4949
*,
5050
datasource_id: str,
5151
question: str,
52+
parameterize: bool | NotGiven = NOT_GIVEN,
5253
role_id: Optional[str] | NotGiven = NOT_GIVEN,
5354
role_variables: Optional[object] | NotGiven = NOT_GIVEN,
54-
separate_params: bool | NotGiven = NOT_GIVEN,
5555
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5656
# The extra values given here take precedence over values defined on the client or passed to this method.
5757
extra_headers: Headers | None = None,
@@ -67,13 +67,13 @@ def create(
6767
6868
question: 查询语句
6969
70+
parameterize: 是否将参数分开传递
71+
7072
role_id: 角色 ID,将扮演这个角色来执行对话,用于权限控制。若无,则跳过鉴权,即可查询所有
7173
数据
7274
7375
role_variables: 在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递
7476
75-
separate_params: 是否将参数分开传递
76-
7777
extra_headers: Send extra headers
7878
7979
extra_query: Add additional query parameters to the request
@@ -88,9 +88,9 @@ def create(
8888
{
8989
"datasource_id": datasource_id,
9090
"question": question,
91+
"parameterize": parameterize,
9192
"role_id": role_id,
9293
"role_variables": role_variables,
93-
"separate_params": separate_params,
9494
},
9595
sql_create_params.SqlCreateParams,
9696
),
@@ -177,9 +177,9 @@ async def create(
177177
*,
178178
datasource_id: str,
179179
question: str,
180+
parameterize: bool | NotGiven = NOT_GIVEN,
180181
role_id: Optional[str] | NotGiven = NOT_GIVEN,
181182
role_variables: Optional[object] | NotGiven = NOT_GIVEN,
182-
separate_params: bool | NotGiven = NOT_GIVEN,
183183
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
184184
# The extra values given here take precedence over values defined on the client or passed to this method.
185185
extra_headers: Headers | None = None,
@@ -195,13 +195,13 @@ async def create(
195195
196196
question: 查询语句
197197
198+
parameterize: 是否将参数分开传递
199+
198200
role_id: 角色 ID,将扮演这个角色来执行对话,用于权限控制。若无,则跳过鉴权,即可查询所有
199201
数据
200202
201203
role_variables: 在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递
202204
203-
separate_params: 是否将参数分开传递
204-
205205
extra_headers: Send extra headers
206206
207207
extra_query: Add additional query parameters to the request
@@ -216,9 +216,9 @@ async def create(
216216
{
217217
"datasource_id": datasource_id,
218218
"question": question,
219+
"parameterize": parameterize,
219220
"role_id": role_id,
220221
"role_variables": role_variables,
221-
"separate_params": separate_params,
222222
},
223223
sql_create_params.SqlCreateParams,
224224
),

src/asktable/types/query_response.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class Query(BaseModel):
1212
sql: str
1313
"""SQL 语句"""
1414

15+
parameterized_sql: Optional[str] = None
16+
"""参数化后的 SQL 语句"""
17+
1518
params: Optional[object] = None
1619
"""参数"""
1720

@@ -23,6 +26,9 @@ class Request(BaseModel):
2326
question: str
2427
"""查询语句"""
2528

29+
parameterize: Optional[bool] = None
30+
"""是否将参数分开传递"""
31+
2632
role_id: Optional[str] = None
2733
"""
2834
角色 ID,将扮演这个角色来执行对话,用于权限控制。若无,则跳过鉴权,即可查询所有
@@ -32,9 +38,6 @@ class Request(BaseModel):
3238
role_variables: Optional[object] = None
3339
"""在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递"""
3440

35-
separate_params: Optional[bool] = None
36-
"""是否将参数分开传递"""
37-
3841

3942
class QueryResponse(BaseModel):
4043
id: str

src/asktable/types/sql_create_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class SqlCreateParams(TypedDict, total=False):
1515
question: Required[str]
1616
"""查询语句"""
1717

18+
parameterize: bool
19+
"""是否将参数分开传递"""
20+
1821
role_id: Optional[str]
1922
"""
2023
角色 ID,将扮演这个角色来执行对话,用于权限控制。若无,则跳过鉴权,即可查询所有
@@ -23,6 +26,3 @@ class SqlCreateParams(TypedDict, total=False):
2326

2427
role_variables: Optional[object]
2528
"""在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递"""
26-
27-
separate_params: bool
28-
"""是否将参数分开传递"""

tests/api_resources/test_sqls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ def test_method_create_with_all_params(self, client: Asktable) -> None:
3131
sql = client.sqls.create(
3232
datasource_id="datasource_id",
3333
question="question",
34+
parameterize=True,
3435
role_id="role_id",
3536
role_variables={},
36-
separate_params=True,
3737
)
3838
assert_matches_type(QueryResponse, sql, path=["response"])
3939

@@ -114,9 +114,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable)
114114
sql = await async_client.sqls.create(
115115
datasource_id="datasource_id",
116116
question="question",
117+
parameterize=True,
117118
role_id="role_id",
118119
role_variables={},
119-
separate_params=True,
120120
)
121121
assert_matches_type(QueryResponse, sql, path=["response"])
122122

0 commit comments

Comments
 (0)