atlan-application-sdk 0.1.1rc42__py3-none-any.whl → 0.1.1rc43__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.
@@ -114,14 +114,17 @@ class ObjectStore:
114
114
 
115
115
  @classmethod
116
116
  async def get_content(
117
- cls, key: str, store_name: str = DEPLOYMENT_OBJECT_STORE_NAME
118
- ) -> bytes:
117
+ cls,
118
+ key: str,
119
+ store_name: str = DEPLOYMENT_OBJECT_STORE_NAME,
120
+ suppress_error: bool = False,
121
+ ) -> bytes | None:
119
122
  """Get raw file content from the object store.
120
123
 
121
124
  Args:
122
125
  key: The path of the file in the object store.
123
126
  store_name: Name of the Dapr object store binding to use.
124
-
127
+ suppress_error: Whether to suppress the error and return None if the file does not exist.
125
128
  Returns:
126
129
  The raw file content as bytes.
127
130
 
@@ -138,14 +141,18 @@ class ObjectStore:
138
141
  store_name=store_name,
139
142
  )
140
143
  if not response_data:
144
+ if suppress_error:
145
+ return None
141
146
  raise Exception(f"No data received for file: {key}")
142
147
 
143
148
  logger.debug(f"Successfully retrieved file content: {key}")
144
149
  return response_data
145
150
 
146
151
  except Exception as e:
152
+ if suppress_error:
153
+ return None
147
154
  logger.error(f"Error getting file content for {key}: {str(e)}")
148
- raise e
155
+ raise
149
156
 
150
157
  @classmethod
151
158
  async def exists(
@@ -463,8 +470,7 @@ class ObjectStore:
463
470
  binding_metadata=metadata,
464
471
  )
465
472
  return response.data
466
- except Exception as e:
467
- logger.error(f"Error in Dapr binding operation '{operation}': {str(e)}")
473
+ except Exception:
468
474
  raise
469
475
 
470
476
  @classmethod
@@ -104,33 +104,26 @@ class StateStore:
104
104
  >>> creds = await StateStore.get_state("db-cred-456", StateType.CREDENTIALS)
105
105
  >>> print(f"Database: {creds.get('database')}")
106
106
  """
107
-
108
107
  state_file_path = build_state_store_path(id, type)
109
- state = {}
110
-
111
108
  try:
112
- logger.info(f"Trying to download state object for {id} with type {type}")
113
- await ObjectStore.download_file(
114
- source=get_object_store_prefix(state_file_path),
115
- destination=state_file_path,
109
+ object_store_content = await ObjectStore.get_content(
110
+ get_object_store_prefix(state_file_path),
116
111
  store_name=UPSTREAM_OBJECT_STORE_NAME,
112
+ suppress_error=True,
117
113
  )
118
-
119
- with open(state_file_path, "r") as file:
120
- state = json.load(file)
121
-
122
- logger.info(f"State object downloaded for {id} with type {type}")
123
- except Exception as e:
124
- # local error message is "file not found", while in object store it is "object not found"
125
- if "not found" in str(e).lower():
126
- logger.info(
114
+ if not object_store_content:
115
+ logger.warning(
127
116
  f"No state found for {type.value} with id '{id}', returning empty dict"
128
117
  )
129
- else:
130
- logger.error(f"Failed to extract state: {str(e)}")
131
- raise
118
+ return {}
132
119
 
133
- return state
120
+ state = json.loads(object_store_content)
121
+ logger.info(f"State object retrieved for {id} with type {type}")
122
+
123
+ return state
124
+ except Exception as e:
125
+ logger.error(f"Failed to extract state: {str(e)}")
126
+ raise
134
127
 
135
128
  @classmethod
136
129
  async def save_state(cls, key: str, value: Any, id: str, type: StateType) -> None:
@@ -240,7 +233,9 @@ class StateStore:
240
233
  ... )
241
234
  """
242
235
  try:
243
- logger.info(f"Saving state object for {id} with type {type}")
236
+ logger.info(
237
+ f"Saving state object in object store for {id} with type {type}"
238
+ )
244
239
  # get the current state from object store
245
240
  current_state = await cls.get_state(id, type)
246
241
  state_file_path = build_state_store_path(id, type)
@@ -260,7 +255,9 @@ class StateStore:
260
255
  destination=get_object_store_prefix(state_file_path),
261
256
  store_name=UPSTREAM_OBJECT_STORE_NAME,
262
257
  )
263
- logger.info(f"State object saved for {id} with type {type}")
258
+ logger.info(
259
+ f"State object created in object store for {id} with type {type}"
260
+ )
264
261
  return current_state
265
262
  except Exception as e:
266
263
  logger.error(f"Failed to store state: {str(e)}")
@@ -2,4 +2,4 @@
2
2
  Version information for the application_sdk package.
3
3
  """
4
4
 
5
- __version__ = "0.1.1rc42"
5
+ __version__ = "0.1.1rc43"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlan-application-sdk
3
- Version: 0.1.1rc42
3
+ Version: 0.1.1rc43
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=1THiejjOEgm4kHFN-PrwrUkfRk7q1pjOLWLm-t2ph1Q,10674
3
- application_sdk/version.py,sha256=Q8mQScZPLmTAD4YMM35CTgtJ-tDFJqdKLeeq94J4GkU,88
3
+ application_sdk/version.py,sha256=pOPlb6TgQCg2UXgZK--_4-tK7RZYGlA1RGlnbCA2f0U,88
4
4
  application_sdk/worker.py,sha256=i5f0AeKI39IfsLO05QkwC6uMz0zDPSJqP7B2byri1VI,7489
5
5
  application_sdk/activities/__init__.py,sha256=QaXLOBYbb0zPOY5kfDQh56qbXQFaYNXOjJ5PCvatiZ4,9530
6
6
  application_sdk/activities/lock_management.py,sha256=L__GZ9BsArwU1ntYwAgCKsSjCqN6QBeOfT-OT4WyD4Y,3983
@@ -92,9 +92,9 @@ application_sdk/server/fastapi/routers/server.py,sha256=vfHQwZCysThzfeVFNVW1IjuA
92
92
  application_sdk/services/__init__.py,sha256=H-5HZEPdr53MUfAggyHqHhRXDRLZFZsxvJgWbr257Ds,465
93
93
  application_sdk/services/atlan_storage.py,sha256=TKzXxu0yXeUcmZehwp8PcnQTC4A9w9RlZ0Fl-Xp1bLE,8509
94
94
  application_sdk/services/eventstore.py,sha256=X03JzodKByXh8w8nOl658rnnZfMFTj0IkmiLVbd6IN8,6729
95
- application_sdk/services/objectstore.py,sha256=XfXWUodkcibFNJrNad5sSbHTrsKMTrRDjZ3HiA7CLf0,17006
95
+ application_sdk/services/objectstore.py,sha256=7TZSQAoba1-2Eb-C8v9ULhba6-Ss9ym4ICjrISr8CAs,17203
96
96
  application_sdk/services/secretstore.py,sha256=UpyLLcdMia1tqFCpRrn-lE9AnERAt2iGVzET6QqkmqI,13976
97
- application_sdk/services/statestore.py,sha256=CQuKq4FXPS0ebDH0e0cfTTAjvsIlrA1zz1MpsWCiWnM,9562
97
+ application_sdk/services/statestore.py,sha256=3-afiM3Vsoe1XDYRokdGTB5I5CwOKyieuX5RwIZf77o,9413
98
98
  application_sdk/test_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
99
  application_sdk/test_utils/workflow_monitoring.py,sha256=gqq6CsT62GrMt2GqtNSb1iD_-t4MBffQvpO0BXboZek,3490
100
100
  application_sdk/test_utils/e2e/__init__.py,sha256=qswG5goB5Xzt3yQyZsKGq20EnZMZCmXYTe0CK3Qk3xo,10125
@@ -152,8 +152,8 @@ application_sdk/workflows/metadata_extraction/__init__.py,sha256=jHUe_ZBQ66jx8bg
152
152
  application_sdk/workflows/metadata_extraction/sql.py,sha256=BhaZavEL8H3Jvf28FGcHtZwqdsUT_EHZ4VTqiaieWek,12278
153
153
  application_sdk/workflows/query_extraction/__init__.py,sha256=n066_CX5RpJz6DIxGMkKS3eGSRg03ilaCtsqfJWQb7Q,117
154
154
  application_sdk/workflows/query_extraction/sql.py,sha256=kT_JQkLCRZ44ZpaC4QvPL6DxnRIIVh8gYHLqRbMI-hA,4826
155
- atlan_application_sdk-0.1.1rc42.dist-info/METADATA,sha256=i1UmEi69_Uelfws3QsQ_AnUCMksuaeBb2O00kAXVGDc,5567
156
- atlan_application_sdk-0.1.1rc42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
157
- atlan_application_sdk-0.1.1rc42.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
158
- atlan_application_sdk-0.1.1rc42.dist-info/licenses/NOTICE,sha256=A-XVVGt3KOYuuMmvSMIFkg534F1vHiCggEBp4Ez3wGk,1041
159
- atlan_application_sdk-0.1.1rc42.dist-info/RECORD,,
155
+ atlan_application_sdk-0.1.1rc43.dist-info/METADATA,sha256=lGqByloEHW-Xxu2fPd38FXaMK641b-SL52pr6tfy5nE,5567
156
+ atlan_application_sdk-0.1.1rc43.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
157
+ atlan_application_sdk-0.1.1rc43.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
158
+ atlan_application_sdk-0.1.1rc43.dist-info/licenses/NOTICE,sha256=A-XVVGt3KOYuuMmvSMIFkg534F1vHiCggEBp4Ez3wGk,1041
159
+ atlan_application_sdk-0.1.1rc43.dist-info/RECORD,,