athena-intelligence 0.1.107__tar.gz → 0.1.109__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 (46) hide show
  1. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/client.py +17 -12
  4. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/client_wrapper.py +1 -1
  5. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/README.md +0 -0
  6. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/__init__.py +0 -0
  7. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/base_client.py +0 -0
  8. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/__init__.py +0 -0
  9. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/api_error.py +0 -0
  10. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/datetime_utils.py +0 -0
  11. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/file.py +0 -0
  12. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/http_client.py +0 -0
  13. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/jsonable_encoder.py +0 -0
  14. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/pydantic_utilities.py +0 -0
  15. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/query_encoder.py +0 -0
  16. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/remove_none_from_dict.py +0 -0
  17. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/core/request_options.py +0 -0
  18. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/environment.py +0 -0
  19. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/__init__.py +0 -0
  20. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/bad_request_error.py +0 -0
  21. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/content_too_large_error.py +0 -0
  22. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/internal_server_error.py +0 -0
  23. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/not_found_error.py +0 -0
  24. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/unauthorized_error.py +0 -0
  25. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/unprocessable_entity_error.py +0 -0
  26. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/errors/unsupported_media_type_error.py +0 -0
  27. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/py.typed +0 -0
  28. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/query/__init__.py +0 -0
  29. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/query/client.py +0 -0
  30. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/query/types/__init__.py +0 -0
  31. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/query/types/query_execute_request_database_asset_ids.py +0 -0
  32. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/tools/__init__.py +0 -0
  33. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/tools/client.py +0 -0
  34. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/tools/types/__init__.py +0 -0
  35. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/tools/types/tools_data_frame_request_columns_item.py +0 -0
  36. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/__init__.py +0 -0
  37. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/asset_not_found_error.py +0 -0
  38. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/data_frame_request_out.py +0 -0
  39. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/data_frame_request_out_columns_item.py +0 -0
  40. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/data_frame_request_out_data_item_item.py +0 -0
  41. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/data_frame_request_out_index_item.py +0 -0
  42. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/data_frame_unknown_format_error.py +0 -0
  43. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/file_too_large_error.py +0 -0
  44. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/parent_folder_error.py +0 -0
  45. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/src/athena/types/save_asset_request_out.py +0 -0
  46. {athena_intelligence-0.1.107 → athena_intelligence-0.1.109}/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.107
3
+ Version: 0.1.109
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.107"
3
+ version = "0.1.109"
4
4
  description = "Athena Intelligence Python Library"
5
5
  readme = "README.md"
6
6
  authors = []
@@ -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.
@@ -213,9 +213,8 @@ class WrappedToolsClient(ToolsClient):
213
213
  "application/sql",
214
214
  }
215
215
 
216
- data = file_bytes.read()
217
-
218
216
  if media_type in supported_media_types:
217
+ data = file_bytes.read()
219
218
  return AthenaAsset(
220
219
  asset_id=asset_id,
221
220
  data=data,
@@ -223,7 +222,7 @@ class WrappedToolsClient(ToolsClient):
223
222
  )
224
223
 
225
224
  if media_type in _pandas_media_types:
226
- return _to_pandas_df(file_bytes)
225
+ return _to_pandas_df(file_bytes, media_type=media_type)
227
226
 
228
227
  raise NotImplementedError("Assets of `{media_type}` type are not yet supported")
229
228
 
@@ -488,21 +487,27 @@ _pandas_media_types = {
488
487
  }
489
488
 
490
489
 
491
- def _to_pandas_df(bytes_io: io.BytesIO, *args, **kwargs):
490
+ def _to_pandas_df(
491
+ bytes_io: io.BytesIO, *args, media_type: Union[str, None] = None, **kwargs
492
+ ):
492
493
  import pandas as pd
493
494
 
494
- media_type = _infer_media_type(bytes_io)
495
+ if media_type is None:
496
+ media_type = _infer_media_type(bytes_io)
495
497
 
496
- if media_type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
497
- return pd.read_excel(bytes_io, *args, engine='openpyxl', **kwargs)
498
- elif media_type in {'application/vnd.apache.parquet', 'application/octet-stream'}:
498
+ if (
499
+ media_type
500
+ == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
501
+ ):
502
+ return pd.read_excel(bytes_io, *args, engine="openpyxl", **kwargs)
503
+ elif media_type in {"application/vnd.apache.parquet", "application/octet-stream"}:
499
504
  return pd.read_parquet(bytes_io, *args, **kwargs)
500
- elif media_type == 'application/vnd.ms-excel':
505
+ elif media_type == "application/vnd.ms-excel":
501
506
  return pd.read_excel(bytes_io, *args, **kwargs)
502
- elif media_type in {'text/csv', 'application/csv'}:
507
+ elif media_type in {"text/csv", "application/csv"}:
503
508
  return pd.read_csv(bytes_io, *args, **kwargs)
504
509
  else:
505
- raise Exception("Unknown media type")
510
+ raise Exception(f"Unknown media type: {media_type}")
506
511
 
507
512
 
508
513
  def _convert_asset_object(
@@ -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.107",
20
+ "X-Fern-SDK-Version": "0.1.109",
21
21
  }
22
22
  headers["X-API-KEY"] = self.api_key
23
23
  return headers