athena-intelligence 0.1.100__tar.gz → 0.1.101__tar.gz

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.
Files changed (43) hide show
  1. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/__init__.py +2 -0
  4. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/client_wrapper.py +1 -1
  5. athena_intelligence-0.1.101/src/athena/query/__init__.py +5 -0
  6. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/query/client.py +120 -2
  7. athena_intelligence-0.1.101/src/athena/query/types/__init__.py +5 -0
  8. athena_intelligence-0.1.101/src/athena/query/types/query_execute_request_database_asset_ids.py +5 -0
  9. athena_intelligence-0.1.100/src/athena/query/__init__.py +0 -2
  10. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/README.md +0 -0
  11. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/base_client.py +0 -0
  12. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/client.py +0 -0
  13. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/__init__.py +0 -0
  14. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/api_error.py +0 -0
  15. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/datetime_utils.py +0 -0
  16. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/file.py +0 -0
  17. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/http_client.py +0 -0
  18. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/jsonable_encoder.py +0 -0
  19. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/pydantic_utilities.py +0 -0
  20. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/query_encoder.py +0 -0
  21. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/remove_none_from_dict.py +0 -0
  22. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/core/request_options.py +0 -0
  23. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/environment.py +0 -0
  24. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/errors/__init__.py +0 -0
  25. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/errors/internal_server_error.py +0 -0
  26. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/errors/not_found_error.py +0 -0
  27. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/errors/unauthorized_error.py +0 -0
  28. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/errors/unprocessable_entity_error.py +0 -0
  29. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/errors/unsupported_media_type_error.py +0 -0
  30. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/py.typed +0 -0
  31. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/tools/__init__.py +0 -0
  32. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/tools/client.py +0 -0
  33. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/tools/types/__init__.py +0 -0
  34. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/tools/types/tools_data_frame_request_columns_item.py +0 -0
  35. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/__init__.py +0 -0
  36. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/data_frame_request_out.py +0 -0
  37. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/data_frame_request_out_columns_item.py +0 -0
  38. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/data_frame_request_out_data_item_item.py +0 -0
  39. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/data_frame_request_out_index_item.py +0 -0
  40. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/data_frame_unknown_format_error.py +0 -0
  41. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/file_fetch_error.py +0 -0
  42. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/types/sql_unauthorized_error.py +0 -0
  43. {athena_intelligence-0.1.100 → athena_intelligence-0.1.101}/src/athena/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.100
3
+ Version: 0.1.101
4
4
  Summary: Athena Intelligence Python Library
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "athena-intelligence"
3
- version = "0.1.100"
3
+ version = "0.1.101"
4
4
  description = "Athena Intelligence Python Library"
5
5
  readme = "README.md"
6
6
  authors = []
@@ -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",
@@ -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.100",
20
+ "X-Fern-SDK-Version": "0.1.101",
21
21
  }
22
22
  headers["X-API-KEY"] = self.api_key
23
23
  return headers
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import QueryExecuteRequestDatabaseAssetIds
4
+
5
+ __all__ = ["QueryExecuteRequestDatabaseAssetIds"]
@@ -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.execute(
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.execute(
218
+ await client.query.execute_snippet(
101
219
  snippet_asset_id="snippet_asset_id",
102
220
  )
103
221
  """
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .query_execute_request_database_asset_ids import QueryExecuteRequestDatabaseAssetIds
4
+
5
+ __all__ = ["QueryExecuteRequestDatabaseAssetIds"]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ QueryExecuteRequestDatabaseAssetIds = typing.Union[str, typing.List[str]]
@@ -1,2 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-