atlan-application-sdk 0.1.1rc25__py3-none-any.whl → 0.1.1rc26__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.
@@ -195,6 +195,38 @@ def prepare_query(
195
195
  return None
196
196
 
197
197
 
198
+ def parse_filter_input(
199
+ filter_input: Union[str, Dict[str, Any], None],
200
+ ) -> Dict[str, Any]:
201
+ """
202
+ Robustly parse filter input from various formats.
203
+
204
+ Args:
205
+ filter_input: Can be None, empty string, JSON string, or dict
206
+
207
+ Returns:
208
+ Dict[str, Any]: Parsed filter dictionary (empty dict if input is invalid/empty)
209
+ """
210
+ # Handle None or empty cases
211
+ if not filter_input:
212
+ return {}
213
+
214
+ # If already a dict, return as-is
215
+ if isinstance(filter_input, dict):
216
+ return filter_input
217
+
218
+ # If it's a string, try to parse as JSON
219
+ if isinstance(filter_input, str):
220
+ # Handle empty string
221
+ if not filter_input.strip():
222
+ return {}
223
+ try:
224
+ return json.loads(filter_input)
225
+ except json.JSONDecodeError as e:
226
+ logger.warning(f"Invalid filter JSON: '{filter_input}', error: {str(e)}")
227
+ raise CommonError(f"Invalid filter JSON: {str(e)}")
228
+
229
+
198
230
  def prepare_filters(
199
231
  include_filter_str: str, exclude_filter_str: str
200
232
  ) -> Tuple[str, str]:
@@ -212,15 +244,8 @@ def prepare_filters(
212
244
  Raises:
213
245
  CommonError: If JSON parsing fails for either filter.
214
246
  """
215
- try:
216
- include_filter = json.loads(include_filter_str)
217
- except json.JSONDecodeError as e:
218
- raise CommonError(f"Invalid include filter JSON: {str(e)}")
219
-
220
- try:
221
- exclude_filter = json.loads(exclude_filter_str)
222
- except json.JSONDecodeError as e:
223
- raise CommonError(f"Invalid exclude filter JSON: {str(e)}")
247
+ include_filter = parse_filter_input(include_filter_str)
248
+ exclude_filter = parse_filter_input(exclude_filter_str)
224
249
 
225
250
  normalized_include_filter_list = normalize_filters(include_filter, True)
226
251
  normalized_exclude_filter_list = normalize_filters(exclude_filter, False)
@@ -1,5 +1,4 @@
1
1
  import asyncio
2
- import json
3
2
  import re
4
3
  from enum import Enum
5
4
  from typing import Any, Dict, List, Optional, Set, Tuple
@@ -7,7 +6,11 @@ from typing import Any, Dict, List, Optional, Set, Tuple
7
6
  from packaging import version
8
7
 
9
8
  from application_sdk.clients.sql import BaseSQLClient
10
- from application_sdk.common.utils import prepare_query, read_sql_files
9
+ from application_sdk.common.utils import (
10
+ parse_filter_input,
11
+ prepare_query,
12
+ read_sql_files,
13
+ )
11
14
  from application_sdk.constants import SQL_QUERIES_PATH, SQL_SERVER_MIN_VERSION
12
15
  from application_sdk.handlers import HandlerInterface
13
16
  from application_sdk.inputs.sql_query import SQLQueryInput
@@ -220,10 +223,10 @@ class BaseSQLHandler(HandlerInterface):
220
223
  """
221
224
  try:
222
225
  schemas_results: List[Dict[str, str]] = await self.prepare_metadata()
223
-
224
- include_filter = json.loads(
225
- payload.get("metadata", {}).get("include-filter", "{}")
226
+ include_filter = parse_filter_input(
227
+ payload.get("metadata", {}).get("include-filter", {})
226
228
  )
229
+
227
230
  allowed_databases, allowed_schemas = self.extract_allowed_schemas(
228
231
  schemas_results
229
232
  )
@@ -2,4 +2,4 @@
2
2
  Version information for the application_sdk package.
3
3
  """
4
4
 
5
- __version__ = "0.1.1rc25"
5
+ __version__ = "0.1.1rc26"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlan-application-sdk
3
- Version: 0.1.1rc25
3
+ Version: 0.1.1rc26
4
4
  Summary: Atlan Application SDK is a Python library for developing applications on the Atlan Platform
5
5
  Project-URL: Repository, https://github.com/atlanhq/application-sdk
6
6
  Project-URL: Documentation, https://github.com/atlanhq/application-sdk/README.md
@@ -1,6 +1,6 @@
1
1
  application_sdk/__init__.py,sha256=2e2mvmLJ5dxmJGPELtb33xwP-j6JMdoIuqKycEn7hjg,151
2
2
  application_sdk/constants.py,sha256=txVsXgN9aBsDXw0Dw9XqYbdTsLTVP5qTS26I1IKpVCA,9111
3
- application_sdk/version.py,sha256=hCIvFphV7kZCRGPxDJyCviFI6EvnPr30f8d6uNV2K8Y,88
3
+ application_sdk/version.py,sha256=fqQ1fw6udcOHy2GZF5O3JVl7ADaHX-iU2cezF5M4P04,88
4
4
  application_sdk/worker.py,sha256=2fLjuKNJafhaQXrHzmxXYO22F4ZSc0igMjoxXVNBFfk,6167
5
5
  application_sdk/activities/__init__.py,sha256=EH5VTHcfGykIX7V1HsG0J1Z-1FbJEXTQOET0HdzFDjU,9519
6
6
  application_sdk/activities/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,7 +24,7 @@ application_sdk/common/aws_utils.py,sha256=aeL3BTMzv1UWJ4KxfwY5EsfYnxtS1FKNJ4xKd
24
24
  application_sdk/common/credential_utils.py,sha256=M9oraG2uPeOSbxUAOJlP2IeClsDD79EhNkdow42dFsI,3025
25
25
  application_sdk/common/dataframe_utils.py,sha256=PId9vT6AUoq3tesiTd4sSUvW7RUhPWdAAEBLuOprks4,1262
26
26
  application_sdk/common/error_codes.py,sha256=uROVfOOMrGPO8JroWB3vs5rIEhr0GfcPqXAK9wdhcVQ,13742
27
- application_sdk/common/utils.py,sha256=t7D1mRTq24CvCLgh0Ms7R_w21Vj7PCiCwOmoiTKatnE,14026
27
+ application_sdk/common/utils.py,sha256=ktCZLp-AEiyd-IPOgbD83Dg9qa8Z0Sj_mJmmdSzpOak,14759
28
28
  application_sdk/docgen/__init__.py,sha256=Gr_3uVEnSspKd_-R1YRsDABI-iP4170Dvg5jM2oD76A,7352
29
29
  application_sdk/docgen/exporters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  application_sdk/docgen/exporters/mkdocs.py,sha256=vxYjKLz-7z7rBUSkOGTdNVlPdx_VPfFfJ31HHNgMCeM,4024
@@ -41,7 +41,7 @@ application_sdk/docgen/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
41
41
  application_sdk/docgen/parsers/directory.py,sha256=8Kk2sjb-0l2wLO_njdlcuHjv5akoNgmf-FmaDSaE4WM,7751
42
42
  application_sdk/docgen/parsers/manifest.py,sha256=3NP-dBTpHAUQa477usMIDaKSb_9xfLE8G3RX0T1Bq2s,3318
43
43
  application_sdk/handlers/__init__.py,sha256=U7kKwVWK0FZz1uIJ2ANN0C5tD83k_9Nyz0ns6ttr92g,1152
44
- application_sdk/handlers/sql.py,sha256=lP3sH6cZK94rJMC-Ul9BomNH3wT-IQ_uwEhh2xAjNaQ,16081
44
+ application_sdk/handlers/sql.py,sha256=qyLbTG9HZYX5_PAsvoSKANVcK53JS3sLUrqXMgXr1T8,16112
45
45
  application_sdk/inputs/__init__.py,sha256=_d-cUhcDyoJTJR3PdQkC831go6VDw9AM6Bg7-qm3NHI,1900
46
46
  application_sdk/inputs/iceberg.py,sha256=xiv1kNtVx1k0h3ZJbJeXjZwdfBGSy9j9orYP_AyCYlI,2756
47
47
  application_sdk/inputs/json.py,sha256=J1CVz0YGQHDyq840TyoBHE7Baua2yIFHzsrybiZbeWk,6079
@@ -129,8 +129,8 @@ application_sdk/workflows/metadata_extraction/__init__.py,sha256=jHUe_ZBQ66jx8bg
129
129
  application_sdk/workflows/metadata_extraction/sql.py,sha256=_NhszxIgmcQI6lVpjJoyJRFLwPYvJw1Dyqox_m9K2RA,11947
130
130
  application_sdk/workflows/query_extraction/__init__.py,sha256=n066_CX5RpJz6DIxGMkKS3eGSRg03ilaCtsqfJWQb7Q,117
131
131
  application_sdk/workflows/query_extraction/sql.py,sha256=kT_JQkLCRZ44ZpaC4QvPL6DxnRIIVh8gYHLqRbMI-hA,4826
132
- atlan_application_sdk-0.1.1rc25.dist-info/METADATA,sha256=lpZs9wBCO8OGYRO_rAJ7cVMBXhuGaVSBZJMdeGPvM4I,5476
133
- atlan_application_sdk-0.1.1rc25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
- atlan_application_sdk-0.1.1rc25.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
135
- atlan_application_sdk-0.1.1rc25.dist-info/licenses/NOTICE,sha256=zlRshGtgfjXFcCKn_hwuILOFV9-NoKe0e2Tjy98_lrw,1044
136
- atlan_application_sdk-0.1.1rc25.dist-info/RECORD,,
132
+ atlan_application_sdk-0.1.1rc26.dist-info/METADATA,sha256=wnjrsH3xghiBQv3BLczFc9_PpnmVhohjtlC80qHzUuo,5476
133
+ atlan_application_sdk-0.1.1rc26.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
+ atlan_application_sdk-0.1.1rc26.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
135
+ atlan_application_sdk-0.1.1rc26.dist-info/licenses/NOTICE,sha256=zlRshGtgfjXFcCKn_hwuILOFV9-NoKe0e2Tjy98_lrw,1044
136
+ atlan_application_sdk-0.1.1rc26.dist-info/RECORD,,