athena-intelligence 0.1.107__py3-none-any.whl → 0.1.108__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/client.py +16 -10
- athena/core/client_wrapper.py +1 -1
- {athena_intelligence-0.1.107.dist-info → athena_intelligence-0.1.108.dist-info}/METADATA +1 -1
- {athena_intelligence-0.1.107.dist-info → athena_intelligence-0.1.108.dist-info}/RECORD +5 -5
- {athena_intelligence-0.1.107.dist-info → athena_intelligence-0.1.108.dist-info}/WHEEL +0 -0
athena/client.py
CHANGED
@@ -48,7 +48,7 @@ class AthenaAsset:
|
|
48
48
|
data: bytes
|
49
49
|
media_type: str
|
50
50
|
|
51
|
-
def _repr_mimebundle_(self):
|
51
|
+
def _repr_mimebundle_(self, include=None, exclude=None):
|
52
52
|
if self.media_type == "application/sql":
|
53
53
|
# it is safe to import IPython in `_repr_mimebundle_`
|
54
54
|
# as this is only intended to be invoked by IPython.
|
@@ -223,7 +223,7 @@ class WrappedToolsClient(ToolsClient):
|
|
223
223
|
)
|
224
224
|
|
225
225
|
if media_type in _pandas_media_types:
|
226
|
-
return _to_pandas_df(file_bytes)
|
226
|
+
return _to_pandas_df(file_bytes, media_type=media_type)
|
227
227
|
|
228
228
|
raise NotImplementedError("Assets of `{media_type}` type are not yet supported")
|
229
229
|
|
@@ -488,21 +488,27 @@ _pandas_media_types = {
|
|
488
488
|
}
|
489
489
|
|
490
490
|
|
491
|
-
def _to_pandas_df(
|
491
|
+
def _to_pandas_df(
|
492
|
+
bytes_io: io.BytesIO, *args, media_type: Union[str, None] = None, **kwargs
|
493
|
+
):
|
492
494
|
import pandas as pd
|
493
495
|
|
494
|
-
media_type
|
496
|
+
if media_type is None:
|
497
|
+
media_type = _infer_media_type(bytes_io)
|
495
498
|
|
496
|
-
if
|
497
|
-
|
498
|
-
|
499
|
+
if (
|
500
|
+
media_type
|
501
|
+
== "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
502
|
+
):
|
503
|
+
return pd.read_excel(bytes_io, *args, engine="openpyxl", **kwargs)
|
504
|
+
elif media_type in {"application/vnd.apache.parquet", "application/octet-stream"}:
|
499
505
|
return pd.read_parquet(bytes_io, *args, **kwargs)
|
500
|
-
elif media_type ==
|
506
|
+
elif media_type == "application/vnd.ms-excel":
|
501
507
|
return pd.read_excel(bytes_io, *args, **kwargs)
|
502
|
-
elif media_type in {
|
508
|
+
elif media_type in {"text/csv", "application/csv"}:
|
503
509
|
return pd.read_csv(bytes_io, *args, **kwargs)
|
504
510
|
else:
|
505
|
-
raise Exception("Unknown media type")
|
511
|
+
raise Exception(f"Unknown media type: {media_type}")
|
506
512
|
|
507
513
|
|
508
514
|
def _convert_asset_object(
|
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.108",
|
21
21
|
}
|
22
22
|
headers["X-API-KEY"] = self.api_key
|
23
23
|
return headers
|
@@ -1,9 +1,9 @@
|
|
1
1
|
athena/__init__.py,sha256=EtDa2cZbHfqJnBxCrjErWF1oJWH0cbJbFB7bkxeOFnE,1392
|
2
2
|
athena/base_client.py,sha256=TlP599mOBvj7Tk8IpFe5dgrDM98GJu3lEQh_zwl4vtA,5439
|
3
|
-
athena/client.py,sha256=
|
3
|
+
athena/client.py,sha256=7_QJAGuad_wkxq1xIelDT2pm4Ke63MfieiU_-d79HLU,18103
|
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=Ve5U7PAZ22Y6Nl6MEPA8JJCJ6ajsBlaP5CGmLg20_k4,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
|
@@ -41,6 +41,6 @@ athena/types/file_too_large_error.py,sha256=AinkrcgR7lcTILAD8RX0x48P3GlSoAh1Oihx
|
|
41
41
|
athena/types/parent_folder_error.py,sha256=ZMF-i3mZY6Mu1n5uQ60Q3mIIfehlWuXtgFUkSYspkx8,1120
|
42
42
|
athena/types/save_asset_request_out.py,sha256=5bpBaUV3oeuL_hz4s07c-6MQHkn4cBsyxgT_SD5oi6I,1193
|
43
43
|
athena/version.py,sha256=8aYAOJtVLaJLpRp6mTiEIhnl8gXA7yE0aDtZ-3mKQ4k,87
|
44
|
-
athena_intelligence-0.1.
|
45
|
-
athena_intelligence-0.1.
|
46
|
-
athena_intelligence-0.1.
|
44
|
+
athena_intelligence-0.1.108.dist-info/METADATA,sha256=iOSFZSFFrhx3kUxhjG_5HDjFJQTzHw6ZNMxxSytNocU,5274
|
45
|
+
athena_intelligence-0.1.108.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
46
|
+
athena_intelligence-0.1.108.dist-info/RECORD,,
|
File without changes
|