pylegend 0.2.0__tar.gz → 0.2.2__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 (115) hide show
  1. {pylegend-0.2.0 → pylegend-0.2.2}/PKG-INFO +2 -1
  2. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/request/auth.py +23 -0
  3. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/request/legend_client.py +10 -4
  4. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/request/service_client.py +13 -2
  5. {pylegend-0.2.0 → pylegend-0.2.2}/pyproject.toml +1 -1
  6. {pylegend-0.2.0 → pylegend-0.2.2}/LICENSE +0 -0
  7. {pylegend-0.2.0 → pylegend-0.2.2}/LICENSE.spdx +0 -0
  8. {pylegend-0.2.0 → pylegend-0.2.2}/README.md +0 -0
  9. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/__init__.py +0 -0
  10. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/_typing.py +0 -0
  11. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/__init__.py +0 -0
  12. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/databse/__init__.py +0 -0
  13. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/databse/sql_to_string/__init__.py +0 -0
  14. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/databse/sql_to_string/config.py +0 -0
  15. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/databse/sql_to_string/db_extension.py +0 -0
  16. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/databse/sql_to_string/generator.py +0 -0
  17. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/__init__.py +0 -0
  18. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/aggregate_specification.py +0 -0
  19. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/column_expressions.py +0 -0
  20. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/expression.py +0 -0
  21. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/functions.py +0 -0
  22. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/literal_expressions.py +0 -0
  23. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/__init__.py +0 -0
  24. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/binary_expression.py +0 -0
  25. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/boolean_operation_expressions.py +0 -0
  26. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/collection_operation_expressions.py +0 -0
  27. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/date_operation_expressions.py +0 -0
  28. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/float_operation_expressions.py +0 -0
  29. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/integer_operation_expressions.py +0 -0
  30. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/nullary_expression.py +0 -0
  31. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/number_operation_expressions.py +0 -0
  32. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/primitive_operation_expressions.py +0 -0
  33. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/string_operation_expressions.py +0 -0
  34. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/operations/unary_expression.py +0 -0
  35. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitive_collection.py +0 -0
  36. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/__init__.py +0 -0
  37. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/boolean.py +0 -0
  38. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/date.py +0 -0
  39. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/datetime.py +0 -0
  40. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/float.py +0 -0
  41. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/integer.py +0 -0
  42. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/number.py +0 -0
  43. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/primitive.py +0 -0
  44. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/strictdate.py +0 -0
  45. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/primitives/string.py +0 -0
  46. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/language/tds_row.py +0 -0
  47. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/project_cooridnates.py +0 -0
  48. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/request/__init__.py +0 -0
  49. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/request/response_reader.py +0 -0
  50. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/sql/__init__.py +0 -0
  51. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/sql/metamodel.py +0 -0
  52. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/sql/metamodel_extension.py +0 -0
  53. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/__init__.py +0 -0
  54. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/__init__.py +0 -0
  55. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/__init__.py +0 -0
  56. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/__init__.py +0 -0
  57. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/concatenate_function.py +0 -0
  58. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/distinct_function.py +0 -0
  59. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/drop_function.py +0 -0
  60. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/extend_function.py +0 -0
  61. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/filter_function.py +0 -0
  62. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/function_helpers.py +0 -0
  63. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/group_by_function.py +0 -0
  64. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/head_function.py +0 -0
  65. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/join_by_columns_function.py +0 -0
  66. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/join_function.py +0 -0
  67. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/rename_columns_function.py +0 -0
  68. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/restrict_function.py +0 -0
  69. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/slice_function.py +0 -0
  70. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/functions/sort_function.py +0 -0
  71. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/legend_api_applied_function_tds_frame.py +0 -0
  72. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/legend_api_base_tds_frame.py +0 -0
  73. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/legend_api_input_tds_frame.py +0 -0
  74. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/legend_api/frames/legend_api_tds_frame.py +0 -0
  75. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/__init__.py +0 -0
  76. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/frames/__init__.py +0 -0
  77. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/frames/functions/__init__.py +0 -0
  78. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/frames/functions/assign_function.py +0 -0
  79. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/frames/pandas_api_applied_function_tds_frame.py +0 -0
  80. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/frames/pandas_api_base_tds_frame.py +0 -0
  81. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/frames/pandas_api_input_tds_frame.py +0 -0
  82. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/pandas_api/frames/pandas_api_tds_frame.py +0 -0
  83. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/result_handler/__init__.py +0 -0
  84. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/result_handler/result_handler.py +0 -0
  85. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/result_handler/to_csv_file_result_handler.py +0 -0
  86. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/result_handler/to_json_file_result_handler.py +0 -0
  87. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/result_handler/to_string_result_handler.py +0 -0
  88. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/sql_query_helpers.py +0 -0
  89. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/tds_column.py +0 -0
  90. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/core/tds/tds_frame.py +0 -0
  91. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/__init__.py +0 -0
  92. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/database/__init__.py +0 -0
  93. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/database/vendors/__init__.py +0 -0
  94. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/database/vendors/postgres/__init__.py +0 -0
  95. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/database/vendors/postgres/postgres_sql_to_string.py +0 -0
  96. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/__init__.py +0 -0
  97. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/abstract/__init__.py +0 -0
  98. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/abstract/legend_function_input_frame.py +0 -0
  99. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/abstract/legend_service_input_frame.py +0 -0
  100. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/abstract/table_spec_input_frame.py +0 -0
  101. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/legend_api/__init__.py +0 -0
  102. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/legend_api/frames/__init__.py +0 -0
  103. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/legend_api/frames/legend_api_legend_function_input_frame.py +0 -0
  104. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/legend_api/frames/legend_api_legend_service_input_frame.py +0 -0
  105. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/legend_api/frames/legend_api_table_spec_input_frame.py +0 -0
  106. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/pandas_api/__init__.py +0 -0
  107. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/pandas_api/frames/__init__.py +0 -0
  108. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/pandas_api/frames/pandas_api_legend_function_input_frame.py +0 -0
  109. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/pandas_api/frames/pandas_api_legend_service_input_frame.py +0 -0
  110. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/pandas_api/frames/pandas_api_table_spec_input_frame.py +0 -0
  111. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/result_handler/__init__.py +0 -0
  112. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/extensions/tds/result_handler/to_pandas_df_result_handler.py +0 -0
  113. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/legend_api_tds_client.py +0 -0
  114. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/utils/__init__.py +0 -0
  115. {pylegend-0.2.0 → pylegend-0.2.2}/pylegend/utils/class_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylegend
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Python language binding for Legend data management platform
5
5
  Home-page: https://github.com/finos/pylegend
6
6
  License: Apache-2.0
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.8
13
13
  Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
16
17
  Requires-Dist: ijson (>=3.1.4)
17
18
  Requires-Dist: numpy (>=1.20.0) ; python_version < "3.12"
18
19
  Requires-Dist: numpy (>=1.26.0) ; python_version >= "3.12"
@@ -13,6 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from abc import ABCMeta, abstractmethod
16
+
17
+ from requests import PreparedRequest
18
+
16
19
  from pylegend._typing import (
17
20
  PyLegendSequence,
18
21
  PyLegendOptional,
@@ -22,6 +25,7 @@ from requests.auth import AuthBase
22
25
  __all__: PyLegendSequence[str] = [
23
26
  "AuthScheme",
24
27
  "LocalhostEmptyAuthScheme",
28
+ "BearerAuthScheme"
25
29
  ]
26
30
 
27
31
 
@@ -36,3 +40,22 @@ class LocalhostEmptyAuthScheme(AuthScheme):
36
40
 
37
41
  def get_auth_base(self) -> PyLegendOptional[AuthBase]:
38
42
  return None
43
+
44
+
45
+ class BearerAuth(AuthBase):
46
+ def __init__(self, headerName: str, token: str) -> None:
47
+ self.headerName = headerName
48
+ self.token = token
49
+
50
+ def __call__(self, r: PreparedRequest) -> PreparedRequest:
51
+ r.headers[self.headerName] = self.token
52
+ return r
53
+
54
+
55
+ class BearerAuthScheme(AuthScheme):
56
+ def __init__(self, headerName: str, token: str) -> None:
57
+ self.headerName = headerName
58
+ self.token = token
59
+
60
+ def get_auth_base(self) -> PyLegendOptional[AuthBase]:
61
+ return BearerAuth(self.headerName, self.token)
@@ -35,12 +35,18 @@ class LegendClient(ServiceClient):
35
35
  self,
36
36
  host: str,
37
37
  port: int,
38
- auth_scheme: AuthScheme = LocalhostEmptyAuthScheme(),
39
38
  secure_http: bool = True,
39
+ path_prefix: PyLegendOptional[str] = "/api",
40
+ auth_scheme: AuthScheme = LocalhostEmptyAuthScheme(),
40
41
  retry_count: int = 2
41
42
  ) -> None:
42
43
  super().__init__(
43
- host=host, port=port, auth_scheme=auth_scheme, secure_http=secure_http, retry_count=retry_count
44
+ host=host,
45
+ port=port,
46
+ secure_http=secure_http,
47
+ path_prefix=path_prefix,
48
+ auth_scheme=auth_scheme,
49
+ retry_count=retry_count
44
50
  )
45
51
 
46
52
  def get_sql_string_schema(
@@ -49,7 +55,7 @@ class LegendClient(ServiceClient):
49
55
  ) -> PyLegendSequence[TdsColumn]:
50
56
  response = super()._execute_service(
51
57
  method=RequestMethod.POST,
52
- path="api/sql/v1/execution/getSchemaFromQueryString",
58
+ path="sql/v1/execution/getSchemaFromQueryString",
53
59
  data=sql,
54
60
  headers={"Content-Type": "text/plain"},
55
61
  stream=False
@@ -64,7 +70,7 @@ class LegendClient(ServiceClient):
64
70
  ) -> ResponseReader:
65
71
  iter_content = super()._execute_service(
66
72
  method=RequestMethod.POST,
67
- path="api/sql/v1/execution/executeQueryString",
73
+ path="sql/v1/execution/executeQueryString",
68
74
  data=sql,
69
75
  headers={"Content-Type": "text/plain"},
70
76
  stream=True
@@ -40,10 +40,19 @@ class RequestMethod(Enum):
40
40
 
41
41
  class ServiceClient(metaclass=ABCMeta):
42
42
 
43
- def __init__(self, host: str, port: int, auth_scheme: AuthScheme, secure_http: bool, retry_count: int) -> None:
43
+ def __init__(
44
+ self,
45
+ host: str,
46
+ port: int,
47
+ secure_http: bool,
48
+ path_prefix: PyLegendOptional[str],
49
+ auth_scheme: AuthScheme,
50
+ retry_count: int
51
+ ) -> None:
44
52
  self.__host = host
45
53
  self.__port = port
46
54
  self.__auth_scheme = auth_scheme
55
+ self.__path_prefix = path_prefix
47
56
  self.__secure_http = secure_http
48
57
  if retry_count < 1:
49
58
  raise ValueError("Retry count should be a number greater than 1. Got " + str(retry_count))
@@ -66,7 +75,9 @@ class ServiceClient(metaclass=ABCMeta):
66
75
  ) -> requests.Response:
67
76
 
68
77
  scheme = "https" if self.__secure_http else "http"
69
- url = f"{scheme}://{self.__host}:{self.__port}/{path}"
78
+ prefix = (self.__path_prefix if self.__path_prefix.startswith("/") else f"/{self.__path_prefix}") \
79
+ if self.__path_prefix is not None else ""
80
+ url = f"{scheme}://{self.__host}:{self.__port}{prefix}/{path}"
70
81
 
71
82
  request = requests.Request(
72
83
  method=method.name,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pylegend"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "Python language binding for Legend data management platform"
5
5
  authors = ["PyLegend Maintainers <legend@finos.org>"]
6
6
  license = "Apache-2.0"
File without changes
File without changes
File without changes
File without changes
File without changes