athena-intelligence 0.1.100__py3-none-any.whl → 0.1.101__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- athena/__init__.py +2 -0
- athena/core/client_wrapper.py +1 -1
- athena/query/__init__.py +3 -0
- athena/query/client.py +120 -2
- athena/query/types/__init__.py +5 -0
- athena/query/types/query_execute_request_database_asset_ids.py +5 -0
- {athena_intelligence-0.1.100.dist-info → athena_intelligence-0.1.101.dist-info}/METADATA +1 -1
- {athena_intelligence-0.1.100.dist-info → athena_intelligence-0.1.101.dist-info}/RECORD +9 -7
- {athena_intelligence-0.1.100.dist-info → athena_intelligence-0.1.101.dist-info}/WHEEL +0 -0
athena/__init__.py
CHANGED
@@ -18,6 +18,7 @@ from .errors import (
|
|
18
18
|
)
|
19
19
|
from . import query, tools
|
20
20
|
from .environment import AthenaEnvironment
|
21
|
+
from .query import QueryExecuteRequestDatabaseAssetIds
|
21
22
|
from .tools import ToolsDataFrameRequestColumnsItem
|
22
23
|
from .version import __version__
|
23
24
|
|
@@ -31,6 +32,7 @@ __all__ = [
|
|
31
32
|
"FileFetchError",
|
32
33
|
"InternalServerError",
|
33
34
|
"NotFoundError",
|
35
|
+
"QueryExecuteRequestDatabaseAssetIds",
|
34
36
|
"SqlUnauthorizedError",
|
35
37
|
"ToolsDataFrameRequestColumnsItem",
|
36
38
|
"UnauthorizedError",
|
athena/core/client_wrapper.py
CHANGED
@@ -17,7 +17,7 @@ class BaseClientWrapper:
|
|
17
17
|
headers: typing.Dict[str, str] = {
|
18
18
|
"X-Fern-Language": "Python",
|
19
19
|
"X-Fern-SDK-Name": "athena-intelligence",
|
20
|
-
"X-Fern-SDK-Version": "0.1.
|
20
|
+
"X-Fern-SDK-Version": "0.1.101",
|
21
21
|
}
|
22
22
|
headers["X-API-KEY"] = self.api_key
|
23
23
|
return headers
|
athena/query/__init__.py
CHANGED
athena/query/client.py
CHANGED
@@ -5,6 +5,7 @@ from json.decoder import JSONDecodeError
|
|
5
5
|
|
6
6
|
from ..core.api_error import ApiError
|
7
7
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
8
9
|
from ..core.pydantic_utilities import pydantic_v1
|
9
10
|
from ..core.request_options import RequestOptions
|
10
11
|
from ..errors.internal_server_error import InternalServerError
|
@@ -12,6 +13,7 @@ from ..errors.unauthorized_error import UnauthorizedError
|
|
12
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
14
|
from ..types.data_frame_request_out import DataFrameRequestOut
|
14
15
|
from ..types.sql_unauthorized_error import SqlUnauthorizedError
|
16
|
+
from .types.query_execute_request_database_asset_ids import QueryExecuteRequestDatabaseAssetIds
|
15
17
|
|
16
18
|
|
17
19
|
class QueryClient:
|
@@ -19,6 +21,64 @@ class QueryClient:
|
|
19
21
|
self._client_wrapper = client_wrapper
|
20
22
|
|
21
23
|
def execute(
|
24
|
+
self,
|
25
|
+
*,
|
26
|
+
sql_command: str,
|
27
|
+
database_asset_ids: QueryExecuteRequestDatabaseAssetIds,
|
28
|
+
request_options: typing.Optional[RequestOptions] = None
|
29
|
+
) -> DataFrameRequestOut:
|
30
|
+
"""
|
31
|
+
Get the result of an SQL query over given assets.
|
32
|
+
|
33
|
+
Parameters
|
34
|
+
----------
|
35
|
+
sql_command : str
|
36
|
+
SQL query string
|
37
|
+
|
38
|
+
database_asset_ids : QueryExecuteRequestDatabaseAssetIds
|
39
|
+
Single ID or list of asset IDs
|
40
|
+
|
41
|
+
request_options : typing.Optional[RequestOptions]
|
42
|
+
Request-specific configuration.
|
43
|
+
|
44
|
+
Returns
|
45
|
+
-------
|
46
|
+
DataFrameRequestOut
|
47
|
+
Successful Response
|
48
|
+
|
49
|
+
Examples
|
50
|
+
--------
|
51
|
+
from athena.client import Athena
|
52
|
+
|
53
|
+
client = Athena(
|
54
|
+
api_key="YOUR_API_KEY",
|
55
|
+
)
|
56
|
+
client.query.execute(
|
57
|
+
sql_command="sql_command",
|
58
|
+
database_asset_ids="database_asset_ids",
|
59
|
+
)
|
60
|
+
"""
|
61
|
+
_response = self._client_wrapper.httpx_client.request(
|
62
|
+
"api/v0/query/sql/code/execute",
|
63
|
+
method="GET",
|
64
|
+
params={"sql_command": sql_command, "database_asset_ids": jsonable_encoder(database_asset_ids)},
|
65
|
+
request_options=request_options,
|
66
|
+
)
|
67
|
+
if 200 <= _response.status_code < 300:
|
68
|
+
return pydantic_v1.parse_obj_as(DataFrameRequestOut, _response.json()) # type: ignore
|
69
|
+
if _response.status_code == 401:
|
70
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(SqlUnauthorizedError, _response.json())) # type: ignore
|
71
|
+
if _response.status_code == 422:
|
72
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
73
|
+
if _response.status_code == 500:
|
74
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
75
|
+
try:
|
76
|
+
_response_json = _response.json()
|
77
|
+
except JSONDecodeError:
|
78
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
79
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
80
|
+
|
81
|
+
def execute_snippet(
|
22
82
|
self, *, snippet_asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
23
83
|
) -> DataFrameRequestOut:
|
24
84
|
"""
|
@@ -43,7 +103,7 @@ class QueryClient:
|
|
43
103
|
client = Athena(
|
44
104
|
api_key="YOUR_API_KEY",
|
45
105
|
)
|
46
|
-
client.query.
|
106
|
+
client.query.execute_snippet(
|
47
107
|
snippet_asset_id="snippet_asset_id",
|
48
108
|
)
|
49
109
|
"""
|
@@ -73,6 +133,64 @@ class AsyncQueryClient:
|
|
73
133
|
self._client_wrapper = client_wrapper
|
74
134
|
|
75
135
|
async def execute(
|
136
|
+
self,
|
137
|
+
*,
|
138
|
+
sql_command: str,
|
139
|
+
database_asset_ids: QueryExecuteRequestDatabaseAssetIds,
|
140
|
+
request_options: typing.Optional[RequestOptions] = None
|
141
|
+
) -> DataFrameRequestOut:
|
142
|
+
"""
|
143
|
+
Get the result of an SQL query over given assets.
|
144
|
+
|
145
|
+
Parameters
|
146
|
+
----------
|
147
|
+
sql_command : str
|
148
|
+
SQL query string
|
149
|
+
|
150
|
+
database_asset_ids : QueryExecuteRequestDatabaseAssetIds
|
151
|
+
Single ID or list of asset IDs
|
152
|
+
|
153
|
+
request_options : typing.Optional[RequestOptions]
|
154
|
+
Request-specific configuration.
|
155
|
+
|
156
|
+
Returns
|
157
|
+
-------
|
158
|
+
DataFrameRequestOut
|
159
|
+
Successful Response
|
160
|
+
|
161
|
+
Examples
|
162
|
+
--------
|
163
|
+
from athena.client import AsyncAthena
|
164
|
+
|
165
|
+
client = AsyncAthena(
|
166
|
+
api_key="YOUR_API_KEY",
|
167
|
+
)
|
168
|
+
await client.query.execute(
|
169
|
+
sql_command="sql_command",
|
170
|
+
database_asset_ids="database_asset_ids",
|
171
|
+
)
|
172
|
+
"""
|
173
|
+
_response = await self._client_wrapper.httpx_client.request(
|
174
|
+
"api/v0/query/sql/code/execute",
|
175
|
+
method="GET",
|
176
|
+
params={"sql_command": sql_command, "database_asset_ids": jsonable_encoder(database_asset_ids)},
|
177
|
+
request_options=request_options,
|
178
|
+
)
|
179
|
+
if 200 <= _response.status_code < 300:
|
180
|
+
return pydantic_v1.parse_obj_as(DataFrameRequestOut, _response.json()) # type: ignore
|
181
|
+
if _response.status_code == 401:
|
182
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(SqlUnauthorizedError, _response.json())) # type: ignore
|
183
|
+
if _response.status_code == 422:
|
184
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
185
|
+
if _response.status_code == 500:
|
186
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
187
|
+
try:
|
188
|
+
_response_json = _response.json()
|
189
|
+
except JSONDecodeError:
|
190
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
191
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
192
|
+
|
193
|
+
async def execute_snippet(
|
76
194
|
self, *, snippet_asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
77
195
|
) -> DataFrameRequestOut:
|
78
196
|
"""
|
@@ -97,7 +215,7 @@ class AsyncQueryClient:
|
|
97
215
|
client = AsyncAthena(
|
98
216
|
api_key="YOUR_API_KEY",
|
99
217
|
)
|
100
|
-
await client.query.
|
218
|
+
await client.query.execute_snippet(
|
101
219
|
snippet_asset_id="snippet_asset_id",
|
102
220
|
)
|
103
221
|
"""
|
@@ -1,9 +1,9 @@
|
|
1
|
-
athena/__init__.py,sha256=
|
1
|
+
athena/__init__.py,sha256=lGo6ASUYoueZCu_oWrD7ruCsa0nLRNo9qZ_-2RV4WxY,1192
|
2
2
|
athena/base_client.py,sha256=TlP599mOBvj7Tk8IpFe5dgrDM98GJu3lEQh_zwl4vtA,5439
|
3
3
|
athena/client.py,sha256=2jxJ8mZWLa9LOH9XCxbxwLV6qVPXw53gi7GiYUTcpZg,9346
|
4
4
|
athena/core/__init__.py,sha256=UFXpYzcGxWQUucU1TkjOQ9mGWN3A5JohluOIWVYKU4I,973
|
5
5
|
athena/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
6
|
-
athena/core/client_wrapper.py,sha256=
|
6
|
+
athena/core/client_wrapper.py,sha256=OWm1dmWnrVS5aatw4sJNN9fa54tiO28qSndRzyy8ksw,1806
|
7
7
|
athena/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
8
8
|
athena/core/file.py,sha256=sy1RUGZ3aJYuw998bZytxxo6QdgKmlnlgBaMvwEKCGg,1480
|
9
9
|
athena/core/http_client.py,sha256=Z4NuAsJD-51yqmoME17O5sxwx5orSp1wsnd6bPyKcgA,17768
|
@@ -20,8 +20,10 @@ athena/errors/unauthorized_error.py,sha256=6qGByG08vA3iFHmK5ReHUK2AiGeCsK3Vf50C5
|
|
20
20
|
athena/errors/unprocessable_entity_error.py,sha256=OztAzRntOJVxbZtXwoR4epahhG6chKOB5chVLUC8D9Q,257
|
21
21
|
athena/errors/unsupported_media_type_error.py,sha256=fQ7TYQ3QYcT_YzFzO4f8_bLger7UQfZmuF22I9jYxFA,340
|
22
22
|
athena/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
|
-
athena/query/__init__.py,sha256=
|
24
|
-
athena/query/client.py,sha256=
|
23
|
+
athena/query/__init__.py,sha256=EIeVs3aDVNAqLyWetSrQldzc2yUdJkf_cJXyrLdMDj0,171
|
24
|
+
athena/query/client.py,sha256=3i_yiGD7JM204TsTwY7R1CvGRs0odCh6QkYeNggHbc8,9147
|
25
|
+
athena/query/types/__init__.py,sha256=WX-Or2h5NY2sv93ojrZsHcmiFHGYdqd0yxNo-5iGHR4,206
|
26
|
+
athena/query/types/query_execute_request_database_asset_ids.py,sha256=aoVl5Xb34Q27hYGuVTnByGIxtHkL67wAwzXh7eJctew,154
|
25
27
|
athena/tools/__init__.py,sha256=3n7oOoMebo06MAQqYRE2CX9Q0fTNnKBYE0cTlh1MPkM,165
|
26
28
|
athena/tools/client.py,sha256=sMV_--PzUReXXILfKJeS8g9GQzYxxPDZI59wlos_rSo,10565
|
27
29
|
athena/tools/types/__init__.py,sha256=cA-ZQm6veQAP3_vKu9KkZpISsQqgTBN_Z--FGY1c2iA,197
|
@@ -35,6 +37,6 @@ athena/types/data_frame_unknown_format_error.py,sha256=lbgAUArEgIYZt3P5Ji4Clp-xy
|
|
35
37
|
athena/types/file_fetch_error.py,sha256=iR7IXjj2C4lJFcWV3aS2gfhmT3CE-_hhBDSWFaCktHU,1162
|
36
38
|
athena/types/sql_unauthorized_error.py,sha256=c3LR7lDgg66km9J0BYDCRu0hdDYaPqpnfcE3YXXKkVM,1105
|
37
39
|
athena/version.py,sha256=8aYAOJtVLaJLpRp6mTiEIhnl8gXA7yE0aDtZ-3mKQ4k,87
|
38
|
-
athena_intelligence-0.1.
|
39
|
-
athena_intelligence-0.1.
|
40
|
-
athena_intelligence-0.1.
|
40
|
+
athena_intelligence-0.1.101.dist-info/METADATA,sha256=vYeSC3K17uL8bbSXmpJ1Vz0mn80WW3LiR5zhJouF0Vw,5274
|
41
|
+
athena_intelligence-0.1.101.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
42
|
+
athena_intelligence-0.1.101.dist-info/RECORD,,
|
File without changes
|