athena-intelligence 0.1.98__tar.gz → 0.1.100__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.
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/PKG-INFO +1 -1
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/pyproject.toml +1 -1
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/__init__.py +12 -10
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/base_client.py +3 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/client.py +17 -17
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/client_wrapper.py +1 -1
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/errors/__init__.py +8 -1
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/errors/internal_server_error.py +3 -2
- athena_intelligence-0.1.100/src/athena/errors/unauthorized_error.py +9 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/errors/unprocessable_entity_error.py +3 -2
- athena_intelligence-0.1.98/src/athena/types/validation_error_loc_item.py → athena_intelligence-0.1.100/src/athena/query/__init__.py +0 -3
- athena_intelligence-0.1.100/src/athena/query/client.py +122 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/tools/client.py +22 -38
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/__init__.py +2 -8
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/data_frame_request_out.py +1 -1
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/data_frame_unknown_format_error.py +1 -1
- athena_intelligence-0.1.98/src/athena/types/data_frame_parsing_error.py → athena_intelligence-0.1.100/src/athena/types/sql_unauthorized_error.py +1 -4
- athena_intelligence-0.1.98/src/athena/types/http_validation_error.py +0 -30
- athena_intelligence-0.1.98/src/athena/types/validation_error.py +0 -32
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/README.md +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/__init__.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/api_error.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/datetime_utils.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/file.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/http_client.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/jsonable_encoder.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/pydantic_utilities.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/query_encoder.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/remove_none_from_dict.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/request_options.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/environment.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/errors/not_found_error.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/errors/unsupported_media_type_error.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/py.typed +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/tools/__init__.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/tools/types/__init__.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/tools/types/tools_data_frame_request_columns_item.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/data_frame_request_out_columns_item.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/data_frame_request_out_data_item_item.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/data_frame_request_out_index_item.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/file_fetch_error.py +0 -0
- {athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/version.py +0 -0
@@ -1,40 +1,42 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
3
|
from .types import (
|
4
|
-
DataFrameParsingError,
|
5
4
|
DataFrameRequestOut,
|
6
5
|
DataFrameRequestOutColumnsItem,
|
7
6
|
DataFrameRequestOutDataItemItem,
|
8
7
|
DataFrameRequestOutIndexItem,
|
9
8
|
DataFrameUnknownFormatError,
|
10
9
|
FileFetchError,
|
11
|
-
|
12
|
-
ValidationError,
|
13
|
-
ValidationErrorLocItem,
|
10
|
+
SqlUnauthorizedError,
|
14
11
|
)
|
15
|
-
from .errors import
|
16
|
-
|
12
|
+
from .errors import (
|
13
|
+
InternalServerError,
|
14
|
+
NotFoundError,
|
15
|
+
UnauthorizedError,
|
16
|
+
UnprocessableEntityError,
|
17
|
+
UnsupportedMediaTypeError,
|
18
|
+
)
|
19
|
+
from . import query, tools
|
17
20
|
from .environment import AthenaEnvironment
|
18
21
|
from .tools import ToolsDataFrameRequestColumnsItem
|
19
22
|
from .version import __version__
|
20
23
|
|
21
24
|
__all__ = [
|
22
25
|
"AthenaEnvironment",
|
23
|
-
"DataFrameParsingError",
|
24
26
|
"DataFrameRequestOut",
|
25
27
|
"DataFrameRequestOutColumnsItem",
|
26
28
|
"DataFrameRequestOutDataItemItem",
|
27
29
|
"DataFrameRequestOutIndexItem",
|
28
30
|
"DataFrameUnknownFormatError",
|
29
31
|
"FileFetchError",
|
30
|
-
"HttpValidationError",
|
31
32
|
"InternalServerError",
|
32
33
|
"NotFoundError",
|
34
|
+
"SqlUnauthorizedError",
|
33
35
|
"ToolsDataFrameRequestColumnsItem",
|
36
|
+
"UnauthorizedError",
|
34
37
|
"UnprocessableEntityError",
|
35
38
|
"UnsupportedMediaTypeError",
|
36
|
-
"ValidationError",
|
37
|
-
"ValidationErrorLocItem",
|
38
39
|
"__version__",
|
40
|
+
"query",
|
39
41
|
"tools",
|
40
42
|
]
|
@@ -6,6 +6,7 @@ import httpx
|
|
6
6
|
|
7
7
|
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
8
|
from .environment import AthenaEnvironment
|
9
|
+
from .query.client import AsyncQueryClient, QueryClient
|
9
10
|
from .tools.client import AsyncToolsClient, ToolsClient
|
10
11
|
|
11
12
|
|
@@ -67,6 +68,7 @@ class BaseAthena:
|
|
67
68
|
else httpx.Client(timeout=_defaulted_timeout),
|
68
69
|
timeout=_defaulted_timeout,
|
69
70
|
)
|
71
|
+
self.query = QueryClient(client_wrapper=self._client_wrapper)
|
70
72
|
self.tools = ToolsClient(client_wrapper=self._client_wrapper)
|
71
73
|
|
72
74
|
|
@@ -128,6 +130,7 @@ class AsyncBaseAthena:
|
|
128
130
|
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
129
131
|
timeout=_defaulted_timeout,
|
130
132
|
)
|
133
|
+
self.query = AsyncQueryClient(client_wrapper=self._client_wrapper)
|
131
134
|
self.tools = AsyncToolsClient(client_wrapper=self._client_wrapper)
|
132
135
|
|
133
136
|
|
@@ -34,11 +34,11 @@ def _inherit_signature_and_doc(
|
|
34
34
|
|
35
35
|
class WrappedToolsClient(ToolsClient):
|
36
36
|
|
37
|
-
def get_file(self,
|
37
|
+
def get_file(self, asset_id: str) -> io.BytesIO:
|
38
38
|
"""
|
39
39
|
Parameters
|
40
40
|
----------
|
41
|
-
|
41
|
+
asset_id : str
|
42
42
|
|
43
43
|
Returns
|
44
44
|
-------
|
@@ -50,28 +50,28 @@ class WrappedToolsClient(ToolsClient):
|
|
50
50
|
from athena.client import Athena
|
51
51
|
|
52
52
|
client = Athena(api_key="YOUR_API_KEY")
|
53
|
-
file_io = client.tools.get_file(
|
53
|
+
file_io = client.tools.get_file(asset_id="asset_id")
|
54
54
|
pl.read_csv(file_io)
|
55
55
|
"""
|
56
|
-
file_bytes = b''.join(self.raw_data(
|
56
|
+
file_bytes = b''.join(self.raw_data(asset_id=asset_id))
|
57
57
|
bytes_io = io.BytesIO(file_bytes)
|
58
58
|
return bytes_io
|
59
59
|
|
60
60
|
@_inherit_signature_and_doc(ToolsClient.data_frame, {'DataFrameRequestOut': 'pd.DataFrame'})
|
61
|
-
def data_frame(self, *,
|
61
|
+
def data_frame(self, *, asset_id: str, **kwargs) -> 'pd.DataFrame':
|
62
62
|
_check_pandas_installed()
|
63
|
-
model = super().data_frame(
|
63
|
+
model = super().data_frame(asset_id=asset_id, **kwargs)
|
64
64
|
return _read_json_frame(model)
|
65
65
|
|
66
|
-
def read_data_frame(self,
|
66
|
+
def read_data_frame(self, asset_id: str, *args, **kwargs) -> 'pd.DataFrame':
|
67
67
|
"""
|
68
68
|
Parameters
|
69
69
|
----------
|
70
|
-
|
70
|
+
asset_id : str
|
71
71
|
|
72
72
|
**kwargs : dict
|
73
73
|
keyword arguments passed to pandas `read_csv` or `read_excel` function,
|
74
|
-
depending on the file type of the document identified by `
|
74
|
+
depending on the file type of the document identified by `asset_id`.
|
75
75
|
|
76
76
|
Returns
|
77
77
|
-------
|
@@ -82,10 +82,10 @@ class WrappedToolsClient(ToolsClient):
|
|
82
82
|
from athena.client import Athena
|
83
83
|
|
84
84
|
client = Athena(api_key="YOUR_API_KEY")
|
85
|
-
client.tools.read_data_frame(
|
85
|
+
client.tools.read_data_frame(asset_id="asset_id")
|
86
86
|
"""
|
87
87
|
_check_pandas_installed()
|
88
|
-
file_bytes = self.get_file(
|
88
|
+
file_bytes = self.get_file(asset_id)
|
89
89
|
return _to_pandas_df(file_bytes, *args, **kwargs)
|
90
90
|
|
91
91
|
|
@@ -105,21 +105,21 @@ def _add_docs_for_async_variant(obj):
|
|
105
105
|
class WrappedAsyncToolsClient(AsyncToolsClient):
|
106
106
|
|
107
107
|
@_add_docs_for_async_variant(WrappedToolsClient.get_file)
|
108
|
-
async def get_file(self,
|
109
|
-
file_bytes = b''.join([gen async for gen in self.raw_data(
|
108
|
+
async def get_file(self, asset_id: str) -> io.BytesIO:
|
109
|
+
file_bytes = b''.join([gen async for gen in self.raw_data(asset_id=asset_id)])
|
110
110
|
bytes_io = io.BytesIO(file_bytes)
|
111
111
|
return bytes_io
|
112
112
|
|
113
113
|
@_inherit_signature_and_doc(AsyncToolsClient.data_frame, {'DataFrameRequestOut': 'pd.DataFrame'})
|
114
|
-
async def data_frame(self, *,
|
114
|
+
async def data_frame(self, *, asset_id: str, **kwargs) -> 'pd.DataFrame':
|
115
115
|
_check_pandas_installed()
|
116
|
-
model = await super().data_frame(
|
116
|
+
model = await super().data_frame(asset_id=asset_id, **kwargs)
|
117
117
|
return _read_json_frame(model)
|
118
118
|
|
119
119
|
@_add_docs_for_async_variant(WrappedToolsClient.read_data_frame)
|
120
|
-
async def read_data_frame(self,
|
120
|
+
async def read_data_frame(self, asset_id: str, *args, **kwargs) -> 'pd.DataFrame':
|
121
121
|
_check_pandas_installed()
|
122
|
-
file_bytes = await self.get_file(
|
122
|
+
file_bytes = await self.get_file(asset_id)
|
123
123
|
return _to_pandas_df(file_bytes, *args, **kwargs)
|
124
124
|
|
125
125
|
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/client_wrapper.py
RENAMED
@@ -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.100",
|
21
21
|
}
|
22
22
|
headers["X-API-KEY"] = self.api_key
|
23
23
|
return headers
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
from .internal_server_error import InternalServerError
|
4
4
|
from .not_found_error import NotFoundError
|
5
|
+
from .unauthorized_error import UnauthorizedError
|
5
6
|
from .unprocessable_entity_error import UnprocessableEntityError
|
6
7
|
from .unsupported_media_type_error import UnsupportedMediaTypeError
|
7
8
|
|
8
|
-
__all__ = [
|
9
|
+
__all__ = [
|
10
|
+
"InternalServerError",
|
11
|
+
"NotFoundError",
|
12
|
+
"UnauthorizedError",
|
13
|
+
"UnprocessableEntityError",
|
14
|
+
"UnsupportedMediaTypeError",
|
15
|
+
]
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
+
import typing
|
4
|
+
|
3
5
|
from ..core.api_error import ApiError
|
4
|
-
from ..types.data_frame_parsing_error import DataFrameParsingError
|
5
6
|
|
6
7
|
|
7
8
|
class InternalServerError(ApiError):
|
8
|
-
def __init__(self, body:
|
9
|
+
def __init__(self, body: typing.Any):
|
9
10
|
super().__init__(status_code=500, body=body)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
from ..core.api_error import ApiError
|
4
|
+
from ..types.sql_unauthorized_error import SqlUnauthorizedError
|
5
|
+
|
6
|
+
|
7
|
+
class UnauthorizedError(ApiError):
|
8
|
+
def __init__(self, body: SqlUnauthorizedError):
|
9
|
+
super().__init__(status_code=401, body=body)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
+
import typing
|
4
|
+
|
3
5
|
from ..core.api_error import ApiError
|
4
|
-
from ..types.http_validation_error import HttpValidationError
|
5
6
|
|
6
7
|
|
7
8
|
class UnprocessableEntityError(ApiError):
|
8
|
-
def __init__(self, body:
|
9
|
+
def __init__(self, body: typing.Any):
|
9
10
|
super().__init__(status_code=422, body=body)
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from json.decoder import JSONDecodeError
|
5
|
+
|
6
|
+
from ..core.api_error import ApiError
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
|
+
from ..core.pydantic_utilities import pydantic_v1
|
9
|
+
from ..core.request_options import RequestOptions
|
10
|
+
from ..errors.internal_server_error import InternalServerError
|
11
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
12
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
|
+
from ..types.data_frame_request_out import DataFrameRequestOut
|
14
|
+
from ..types.sql_unauthorized_error import SqlUnauthorizedError
|
15
|
+
|
16
|
+
|
17
|
+
class QueryClient:
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
19
|
+
self._client_wrapper = client_wrapper
|
20
|
+
|
21
|
+
def execute(
|
22
|
+
self, *, snippet_asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
23
|
+
) -> DataFrameRequestOut:
|
24
|
+
"""
|
25
|
+
Get the result of an SQL query over given assets.
|
26
|
+
|
27
|
+
Parameters
|
28
|
+
----------
|
29
|
+
snippet_asset_id : str
|
30
|
+
|
31
|
+
request_options : typing.Optional[RequestOptions]
|
32
|
+
Request-specific configuration.
|
33
|
+
|
34
|
+
Returns
|
35
|
+
-------
|
36
|
+
DataFrameRequestOut
|
37
|
+
Successful Response
|
38
|
+
|
39
|
+
Examples
|
40
|
+
--------
|
41
|
+
from athena.client import Athena
|
42
|
+
|
43
|
+
client = Athena(
|
44
|
+
api_key="YOUR_API_KEY",
|
45
|
+
)
|
46
|
+
client.query.execute(
|
47
|
+
snippet_asset_id="snippet_asset_id",
|
48
|
+
)
|
49
|
+
"""
|
50
|
+
_response = self._client_wrapper.httpx_client.request(
|
51
|
+
"api/v0/query/sql/snippet/execute",
|
52
|
+
method="GET",
|
53
|
+
params={"snippet_asset_id": snippet_asset_id},
|
54
|
+
request_options=request_options,
|
55
|
+
)
|
56
|
+
if 200 <= _response.status_code < 300:
|
57
|
+
return pydantic_v1.parse_obj_as(DataFrameRequestOut, _response.json()) # type: ignore
|
58
|
+
if _response.status_code == 401:
|
59
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(SqlUnauthorizedError, _response.json())) # type: ignore
|
60
|
+
if _response.status_code == 422:
|
61
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
62
|
+
if _response.status_code == 500:
|
63
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
64
|
+
try:
|
65
|
+
_response_json = _response.json()
|
66
|
+
except JSONDecodeError:
|
67
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
68
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
69
|
+
|
70
|
+
|
71
|
+
class AsyncQueryClient:
|
72
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
73
|
+
self._client_wrapper = client_wrapper
|
74
|
+
|
75
|
+
async def execute(
|
76
|
+
self, *, snippet_asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
77
|
+
) -> DataFrameRequestOut:
|
78
|
+
"""
|
79
|
+
Get the result of an SQL query over given assets.
|
80
|
+
|
81
|
+
Parameters
|
82
|
+
----------
|
83
|
+
snippet_asset_id : str
|
84
|
+
|
85
|
+
request_options : typing.Optional[RequestOptions]
|
86
|
+
Request-specific configuration.
|
87
|
+
|
88
|
+
Returns
|
89
|
+
-------
|
90
|
+
DataFrameRequestOut
|
91
|
+
Successful Response
|
92
|
+
|
93
|
+
Examples
|
94
|
+
--------
|
95
|
+
from athena.client import AsyncAthena
|
96
|
+
|
97
|
+
client = AsyncAthena(
|
98
|
+
api_key="YOUR_API_KEY",
|
99
|
+
)
|
100
|
+
await client.query.execute(
|
101
|
+
snippet_asset_id="snippet_asset_id",
|
102
|
+
)
|
103
|
+
"""
|
104
|
+
_response = await self._client_wrapper.httpx_client.request(
|
105
|
+
"api/v0/query/sql/snippet/execute",
|
106
|
+
method="GET",
|
107
|
+
params={"snippet_asset_id": snippet_asset_id},
|
108
|
+
request_options=request_options,
|
109
|
+
)
|
110
|
+
if 200 <= _response.status_code < 300:
|
111
|
+
return pydantic_v1.parse_obj_as(DataFrameRequestOut, _response.json()) # type: ignore
|
112
|
+
if _response.status_code == 401:
|
113
|
+
raise UnauthorizedError(pydantic_v1.parse_obj_as(SqlUnauthorizedError, _response.json())) # type: ignore
|
114
|
+
if _response.status_code == 422:
|
115
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
116
|
+
if _response.status_code == 500:
|
117
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
118
|
+
try:
|
119
|
+
_response_json = _response.json()
|
120
|
+
except JSONDecodeError:
|
121
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
122
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
@@ -11,11 +11,9 @@ from ..errors.internal_server_error import InternalServerError
|
|
11
11
|
from ..errors.not_found_error import NotFoundError
|
12
12
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
13
13
|
from ..errors.unsupported_media_type_error import UnsupportedMediaTypeError
|
14
|
-
from ..types.data_frame_parsing_error import DataFrameParsingError
|
15
14
|
from ..types.data_frame_request_out import DataFrameRequestOut
|
16
15
|
from ..types.data_frame_unknown_format_error import DataFrameUnknownFormatError
|
17
16
|
from ..types.file_fetch_error import FileFetchError
|
18
|
-
from ..types.http_validation_error import HttpValidationError
|
19
17
|
from .types.tools_data_frame_request_columns_item import ToolsDataFrameRequestColumnsItem
|
20
18
|
|
21
19
|
|
@@ -26,7 +24,7 @@ class ToolsClient:
|
|
26
24
|
def data_frame(
|
27
25
|
self,
|
28
26
|
*,
|
29
|
-
|
27
|
+
asset_id: str,
|
30
28
|
row_limit: typing.Optional[int] = None,
|
31
29
|
index_column: typing.Optional[int] = None,
|
32
30
|
columns: typing.Optional[
|
@@ -39,7 +37,7 @@ class ToolsClient:
|
|
39
37
|
"""
|
40
38
|
Parameters
|
41
39
|
----------
|
42
|
-
|
40
|
+
asset_id : str
|
43
41
|
|
44
42
|
row_limit : typing.Optional[int]
|
45
43
|
|
@@ -70,14 +68,14 @@ class ToolsClient:
|
|
70
68
|
api_key="YOUR_API_KEY",
|
71
69
|
)
|
72
70
|
client.tools.data_frame(
|
73
|
-
|
71
|
+
asset_id="asset_id",
|
74
72
|
)
|
75
73
|
"""
|
76
74
|
_response = self._client_wrapper.httpx_client.request(
|
77
75
|
"api/v0/tools/file/data-frame",
|
78
76
|
method="GET",
|
79
77
|
params={
|
80
|
-
"
|
78
|
+
"asset_id": asset_id,
|
81
79
|
"row_limit": row_limit,
|
82
80
|
"index_column": index_column,
|
83
81
|
"columns": columns,
|
@@ -95,11 +93,9 @@ class ToolsClient:
|
|
95
93
|
pydantic_v1.parse_obj_as(DataFrameUnknownFormatError, _response.json()) # type: ignore
|
96
94
|
)
|
97
95
|
if _response.status_code == 422:
|
98
|
-
raise UnprocessableEntityError(
|
99
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
100
|
-
)
|
96
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
101
97
|
if _response.status_code == 500:
|
102
|
-
raise InternalServerError(pydantic_v1.parse_obj_as(
|
98
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
103
99
|
try:
|
104
100
|
_response_json = _response.json()
|
105
101
|
except JSONDecodeError:
|
@@ -107,14 +103,14 @@ class ToolsClient:
|
|
107
103
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
108
104
|
|
109
105
|
def raw_data(
|
110
|
-
self, *,
|
106
|
+
self, *, asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
111
107
|
) -> typing.Iterator[bytes]:
|
112
108
|
"""
|
113
109
|
Get the raw file data for given asset.
|
114
110
|
|
115
111
|
Parameters
|
116
112
|
----------
|
117
|
-
|
113
|
+
asset_id : str
|
118
114
|
|
119
115
|
request_options : typing.Optional[RequestOptions]
|
120
116
|
Request-specific configuration.
|
@@ -132,14 +128,11 @@ class ToolsClient:
|
|
132
128
|
api_key="YOUR_API_KEY",
|
133
129
|
)
|
134
130
|
client.tools.raw_data(
|
135
|
-
|
131
|
+
asset_id="string",
|
136
132
|
)
|
137
133
|
"""
|
138
134
|
with self._client_wrapper.httpx_client.stream(
|
139
|
-
"api/v0/tools/file/raw-data",
|
140
|
-
method="GET",
|
141
|
-
params={"document_id": document_id},
|
142
|
-
request_options=request_options,
|
135
|
+
"api/v0/tools/file/raw-data", method="GET", params={"asset_id": asset_id}, request_options=request_options
|
143
136
|
) as _response:
|
144
137
|
if 200 <= _response.status_code < 300:
|
145
138
|
for _chunk in _response.iter_bytes():
|
@@ -149,9 +142,7 @@ class ToolsClient:
|
|
149
142
|
if _response.status_code == 404:
|
150
143
|
raise NotFoundError(pydantic_v1.parse_obj_as(FileFetchError, _response.json())) # type: ignore
|
151
144
|
if _response.status_code == 422:
|
152
|
-
raise UnprocessableEntityError(
|
153
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
154
|
-
)
|
145
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
155
146
|
try:
|
156
147
|
_response_json = _response.json()
|
157
148
|
except JSONDecodeError:
|
@@ -166,7 +157,7 @@ class AsyncToolsClient:
|
|
166
157
|
async def data_frame(
|
167
158
|
self,
|
168
159
|
*,
|
169
|
-
|
160
|
+
asset_id: str,
|
170
161
|
row_limit: typing.Optional[int] = None,
|
171
162
|
index_column: typing.Optional[int] = None,
|
172
163
|
columns: typing.Optional[
|
@@ -179,7 +170,7 @@ class AsyncToolsClient:
|
|
179
170
|
"""
|
180
171
|
Parameters
|
181
172
|
----------
|
182
|
-
|
173
|
+
asset_id : str
|
183
174
|
|
184
175
|
row_limit : typing.Optional[int]
|
185
176
|
|
@@ -210,14 +201,14 @@ class AsyncToolsClient:
|
|
210
201
|
api_key="YOUR_API_KEY",
|
211
202
|
)
|
212
203
|
await client.tools.data_frame(
|
213
|
-
|
204
|
+
asset_id="asset_id",
|
214
205
|
)
|
215
206
|
"""
|
216
207
|
_response = await self._client_wrapper.httpx_client.request(
|
217
208
|
"api/v0/tools/file/data-frame",
|
218
209
|
method="GET",
|
219
210
|
params={
|
220
|
-
"
|
211
|
+
"asset_id": asset_id,
|
221
212
|
"row_limit": row_limit,
|
222
213
|
"index_column": index_column,
|
223
214
|
"columns": columns,
|
@@ -235,11 +226,9 @@ class AsyncToolsClient:
|
|
235
226
|
pydantic_v1.parse_obj_as(DataFrameUnknownFormatError, _response.json()) # type: ignore
|
236
227
|
)
|
237
228
|
if _response.status_code == 422:
|
238
|
-
raise UnprocessableEntityError(
|
239
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
240
|
-
)
|
229
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
241
230
|
if _response.status_code == 500:
|
242
|
-
raise InternalServerError(pydantic_v1.parse_obj_as(
|
231
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
243
232
|
try:
|
244
233
|
_response_json = _response.json()
|
245
234
|
except JSONDecodeError:
|
@@ -247,14 +236,14 @@ class AsyncToolsClient:
|
|
247
236
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
248
237
|
|
249
238
|
async def raw_data(
|
250
|
-
self, *,
|
239
|
+
self, *, asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
251
240
|
) -> typing.AsyncIterator[bytes]:
|
252
241
|
"""
|
253
242
|
Get the raw file data for given asset.
|
254
243
|
|
255
244
|
Parameters
|
256
245
|
----------
|
257
|
-
|
246
|
+
asset_id : str
|
258
247
|
|
259
248
|
request_options : typing.Optional[RequestOptions]
|
260
249
|
Request-specific configuration.
|
@@ -272,14 +261,11 @@ class AsyncToolsClient:
|
|
272
261
|
api_key="YOUR_API_KEY",
|
273
262
|
)
|
274
263
|
await client.tools.raw_data(
|
275
|
-
|
264
|
+
asset_id="string",
|
276
265
|
)
|
277
266
|
"""
|
278
267
|
async with self._client_wrapper.httpx_client.stream(
|
279
|
-
"api/v0/tools/file/raw-data",
|
280
|
-
method="GET",
|
281
|
-
params={"document_id": document_id},
|
282
|
-
request_options=request_options,
|
268
|
+
"api/v0/tools/file/raw-data", method="GET", params={"asset_id": asset_id}, request_options=request_options
|
283
269
|
) as _response:
|
284
270
|
if 200 <= _response.status_code < 300:
|
285
271
|
async for _chunk in _response.aiter_bytes():
|
@@ -289,9 +275,7 @@ class AsyncToolsClient:
|
|
289
275
|
if _response.status_code == 404:
|
290
276
|
raise NotFoundError(pydantic_v1.parse_obj_as(FileFetchError, _response.json())) # type: ignore
|
291
277
|
if _response.status_code == 422:
|
292
|
-
raise UnprocessableEntityError(
|
293
|
-
pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
|
294
|
-
)
|
278
|
+
raise UnprocessableEntityError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
295
279
|
try:
|
296
280
|
_response_json = _response.json()
|
297
281
|
except JSONDecodeError:
|
@@ -1,25 +1,19 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
-
from .data_frame_parsing_error import DataFrameParsingError
|
4
3
|
from .data_frame_request_out import DataFrameRequestOut
|
5
4
|
from .data_frame_request_out_columns_item import DataFrameRequestOutColumnsItem
|
6
5
|
from .data_frame_request_out_data_item_item import DataFrameRequestOutDataItemItem
|
7
6
|
from .data_frame_request_out_index_item import DataFrameRequestOutIndexItem
|
8
7
|
from .data_frame_unknown_format_error import DataFrameUnknownFormatError
|
9
8
|
from .file_fetch_error import FileFetchError
|
10
|
-
from .
|
11
|
-
from .validation_error import ValidationError
|
12
|
-
from .validation_error_loc_item import ValidationErrorLocItem
|
9
|
+
from .sql_unauthorized_error import SqlUnauthorizedError
|
13
10
|
|
14
11
|
__all__ = [
|
15
|
-
"DataFrameParsingError",
|
16
12
|
"DataFrameRequestOut",
|
17
13
|
"DataFrameRequestOutColumnsItem",
|
18
14
|
"DataFrameRequestOutDataItemItem",
|
19
15
|
"DataFrameRequestOutIndexItem",
|
20
16
|
"DataFrameUnknownFormatError",
|
21
17
|
"FileFetchError",
|
22
|
-
"
|
23
|
-
"ValidationError",
|
24
|
-
"ValidationErrorLocItem",
|
18
|
+
"SqlUnauthorizedError",
|
25
19
|
]
|
@@ -17,7 +17,7 @@ class DataFrameRequestOut(pydantic_v1.BaseModel):
|
|
17
17
|
|
18
18
|
columns: typing.List[typing.Optional[DataFrameRequestOutColumnsItem]]
|
19
19
|
data: typing.List[typing.List[typing.Optional[DataFrameRequestOutDataItemItem]]]
|
20
|
-
index: typing.List[typing.Optional[DataFrameRequestOutIndexItem]]
|
20
|
+
index: typing.Optional[typing.List[typing.Optional[DataFrameRequestOutIndexItem]]] = None
|
21
21
|
|
22
22
|
def json(self, **kwargs: typing.Any) -> str:
|
23
23
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -7,10 +7,7 @@ from ..core.datetime_utils import serialize_datetime
|
|
7
7
|
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
8
8
|
|
9
9
|
|
10
|
-
class
|
11
|
-
document_id: str
|
12
|
-
message: str
|
13
|
-
|
10
|
+
class SqlUnauthorizedError(pydantic_v1.BaseModel):
|
14
11
|
def json(self, **kwargs: typing.Any) -> str:
|
15
12
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
16
13
|
return super().json(**kwargs_with_defaults)
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
2
|
-
|
3
|
-
import datetime as dt
|
4
|
-
import typing
|
5
|
-
|
6
|
-
from ..core.datetime_utils import serialize_datetime
|
7
|
-
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
8
|
-
from .validation_error import ValidationError
|
9
|
-
|
10
|
-
|
11
|
-
class HttpValidationError(pydantic_v1.BaseModel):
|
12
|
-
detail: typing.Optional[typing.List[ValidationError]] = None
|
13
|
-
|
14
|
-
def json(self, **kwargs: typing.Any) -> str:
|
15
|
-
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
16
|
-
return super().json(**kwargs_with_defaults)
|
17
|
-
|
18
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
19
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
20
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
21
|
-
|
22
|
-
return deep_union_pydantic_dicts(
|
23
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
24
|
-
)
|
25
|
-
|
26
|
-
class Config:
|
27
|
-
frozen = True
|
28
|
-
smart_union = True
|
29
|
-
extra = pydantic_v1.Extra.allow
|
30
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
2
|
-
|
3
|
-
import datetime as dt
|
4
|
-
import typing
|
5
|
-
|
6
|
-
from ..core.datetime_utils import serialize_datetime
|
7
|
-
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
8
|
-
from .validation_error_loc_item import ValidationErrorLocItem
|
9
|
-
|
10
|
-
|
11
|
-
class ValidationError(pydantic_v1.BaseModel):
|
12
|
-
loc: typing.List[ValidationErrorLocItem]
|
13
|
-
msg: str
|
14
|
-
type: str
|
15
|
-
|
16
|
-
def json(self, **kwargs: typing.Any) -> str:
|
17
|
-
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
18
|
-
return super().json(**kwargs_with_defaults)
|
19
|
-
|
20
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
21
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
22
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
23
|
-
|
24
|
-
return deep_union_pydantic_dicts(
|
25
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
26
|
-
)
|
27
|
-
|
28
|
-
class Config:
|
29
|
-
frozen = True
|
30
|
-
smart_union = True
|
31
|
-
extra = pydantic_v1.Extra.allow
|
32
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
File without changes
|
File without changes
|
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/datetime_utils.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/jsonable_encoder.py
RENAMED
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/pydantic_utilities.py
RENAMED
File without changes
|
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/remove_none_from_dict.py
RENAMED
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/core/request_options.py
RENAMED
File without changes
|
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/errors/not_found_error.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/tools/types/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{athena_intelligence-0.1.98 → athena_intelligence-0.1.100}/src/athena/types/file_fetch_error.py
RENAMED
File without changes
|
File without changes
|