atlan-application-sdk 1.0.0__py3-none-any.whl → 1.0.2__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.
@@ -850,7 +850,7 @@ class BaseSQLMetadataExtractionActivities(ActivitiesInterface):
850
850
  dataframe=dataframe, **workflow_args
851
851
  )
852
852
  await transformed_output.write_daft_dataframe(transform_metadata)
853
- return await transformed_output.get_statistics()
853
+ return await transformed_output.get_statistics(typename=typename)
854
854
 
855
855
  @activity.defn
856
856
  @auto_heartbeater
@@ -7,9 +7,9 @@ from time import time_ns
7
7
  from typing import Any, Dict, Optional, Tuple
8
8
 
9
9
  from loguru import logger
10
- from opentelemetry._logs import SeverityNumber
10
+ from opentelemetry._logs import LogRecord, SeverityNumber
11
11
  from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
12
- from opentelemetry.sdk._logs import LoggerProvider, LogRecord
12
+ from opentelemetry.sdk._logs import LoggerProvider
13
13
  from opentelemetry.sdk._logs._internal.export import BatchLogRecordProcessor
14
14
  from opentelemetry.sdk.resources import Resource
15
15
  from opentelemetry.trace.span import TraceFlags
@@ -287,12 +287,24 @@ class AtlanLoggerAdapter(AtlanObservability[LogRecordModel]):
287
287
  )
288
288
 
289
289
  # Update format string to use the bound logger_name
290
- atlan_format_str = "<green>{time:YYYY-MM-DD HH:mm:ss}</green> <blue>[{level}]</blue> <cyan>{extra[logger_name]}</cyan> - <level>{message}</level>"
290
+ atlan_format_str_color = "<green>{time:YYYY-MM-DD HH:mm:ss}</green> <blue>[{level}]</blue> <cyan>{extra[logger_name]}</cyan> - <level>{message}</level>"
291
+ atlan_format_str_plain = (
292
+ "{time:YYYY-MM-DD HH:mm:ss} [{level}] {extra[logger_name]} - {message}"
293
+ )
294
+
295
+ colorize = False
296
+ format_str = atlan_format_str_plain
297
+
298
+ # Colorize the logs only if the log level is DEBUG
299
+ if LOG_LEVEL == "DEBUG":
300
+ colorize = True
301
+ format_str = atlan_format_str_color
302
+
291
303
  self.logger.add(
292
304
  sys.stderr,
293
- format=atlan_format_str,
305
+ format=format_str,
294
306
  level=SEVERITY_MAPPING[LOG_LEVEL],
295
- colorize=True,
307
+ colorize=colorize,
296
308
  )
297
309
 
298
310
  # Add sink for parquet logging only if Dapr sink is enabled
@@ -495,7 +507,6 @@ class AtlanLoggerAdapter(AtlanObservability[LogRecordModel]):
495
507
  severity_text=record["level"],
496
508
  severity_number=severity_number,
497
509
  body=record["message"],
498
- resource=self.logger_provider.resource,
499
510
  attributes=attributes,
500
511
  )
501
512
 
@@ -34,6 +34,7 @@ from application_sdk.services.objectstore import ObjectStore
34
34
  logger = get_logger(__name__)
35
35
  activity.logger = logger
36
36
 
37
+
37
38
  if TYPE_CHECKING:
38
39
  import daft # type: ignore
39
40
  import pandas as pd
@@ -330,7 +331,7 @@ class Output(ABC):
330
331
  Exception: If there's an error writing the statistics
331
332
  """
332
333
  try:
333
- statistics = await self.write_statistics()
334
+ statistics = await self.write_statistics(typename)
334
335
  if not statistics:
335
336
  raise ValueError("No statistics data available")
336
337
  statistics = ActivityStatistics.model_validate(statistics)
@@ -390,7 +391,9 @@ class Output(ABC):
390
391
  logger.error(f"Error flushing buffer to files: {str(e)}")
391
392
  raise e
392
393
 
393
- async def write_statistics(self) -> Optional[Dict[str, Any]]:
394
+ async def write_statistics(
395
+ self, typename: Optional[str] = None
396
+ ) -> Optional[Dict[str, Any]]:
394
397
  """Write statistics about the output to a JSON file.
395
398
 
396
399
  This method writes statistics including total record count and chunk count
@@ -407,10 +410,28 @@ class Output(ABC):
407
410
  "partitions": self.partitions,
408
411
  }
409
412
 
410
- # Write the statistics to a json file
411
- output_file_name = f"{self.output_path}/statistics.json.ignore"
412
- with open(output_file_name, "w") as f:
413
- f.write(orjson.dumps(statistics).decode("utf-8"))
413
+ # Ensure typename is included in the statistics payload (if provided)
414
+ if typename:
415
+ statistics["typename"] = typename
416
+
417
+ # Write the statistics to a json file inside a dedicated statistics/ folder
418
+ statistics_dir = os.path.join(self.output_path, "statistics")
419
+ os.makedirs(statistics_dir, exist_ok=True)
420
+ output_file_name = os.path.join(statistics_dir, "statistics.json.ignore")
421
+ # If chunk_start is provided, include it in the statistics filename
422
+ try:
423
+ cs = getattr(self, "chunk_start", None)
424
+ if cs is not None:
425
+ output_file_name = os.path.join(
426
+ statistics_dir, f"statistics-chunk-{cs}.json.ignore"
427
+ )
428
+ except Exception:
429
+ # If accessing chunk_start fails, fallback to default filename
430
+ pass
431
+
432
+ # Write the statistics dictionary to the JSON file
433
+ with open(output_file_name, "wb") as f:
434
+ f.write(orjson.dumps(statistics))
414
435
 
415
436
  destination_file_path = get_object_store_prefix(output_file_name)
416
437
  # Push the file to the object store
@@ -418,6 +439,7 @@ class Output(ABC):
418
439
  source=output_file_name,
419
440
  destination=destination_file_path,
420
441
  )
442
+
421
443
  return statistics
422
444
  except Exception as e:
423
445
  logger.error(f"Error writing statistics: {str(e)}")
@@ -2,4 +2,4 @@
2
2
  Version information for the application_sdk package.
3
3
  """
4
4
 
5
- __version__ = "1.0.0"
5
+ __version__ = "1.0.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlan-application-sdk
3
- Version: 1.0.0
3
+ Version: 1.0.2
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
@@ -19,45 +19,45 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
21
  Requires-Python: >=3.11
22
- Requires-Dist: aiohttp>=3.10.0
23
- Requires-Dist: duckdb-engine>=0.17.0
24
- Requires-Dist: duckdb>=1.1.3
22
+ Requires-Dist: aiohttp<3.14.0,>=3.10.0
23
+ Requires-Dist: duckdb-engine<0.18.0,>=0.17.0
24
+ Requires-Dist: duckdb<1.5.0,>=1.1.3
25
25
  Requires-Dist: fastapi[standard]==0.120.2
26
- Requires-Dist: loguru>=0.7.3
27
- Requires-Dist: opentelemetry-exporter-otlp>=1.27.0
28
- Requires-Dist: psutil>=7.0.0
29
- Requires-Dist: pyatlan>=8.0.2
30
- Requires-Dist: pydantic>=2.10.6
31
- Requires-Dist: python-dotenv>=1.1.0
32
- Requires-Dist: uvloop>=0.21.0; sys_platform != 'win32'
26
+ Requires-Dist: loguru<0.8.0,>=0.7.3
27
+ Requires-Dist: opentelemetry-exporter-otlp==1.39.0
28
+ Requires-Dist: psutil<7.2.0,>=7.0.0
29
+ Requires-Dist: pyatlan<8.5.0,>=8.0.2
30
+ Requires-Dist: pydantic<2.13.0,>=2.10.6
31
+ Requires-Dist: python-dotenv<1.3.0,>=1.1.0
32
+ Requires-Dist: uvloop<0.23.0,>=0.21.0; sys_platform != 'win32'
33
33
  Provides-Extra: daft
34
- Requires-Dist: daft>=0.4.12; extra == 'daft'
34
+ Requires-Dist: daft<0.7.0,>=0.4.12; extra == 'daft'
35
35
  Provides-Extra: distributed-lock
36
- Requires-Dist: redis[hiredis]>=5.2.0; extra == 'distributed-lock'
36
+ Requires-Dist: redis[hiredis]<7.2.0,>=5.2.0; extra == 'distributed-lock'
37
37
  Provides-Extra: iam-auth
38
- Requires-Dist: boto3>=1.38.6; extra == 'iam-auth'
38
+ Requires-Dist: boto3<1.43.0,>=1.38.6; extra == 'iam-auth'
39
39
  Provides-Extra: iceberg
40
- Requires-Dist: pyiceberg>=0.8.1; extra == 'iceberg'
40
+ Requires-Dist: pyiceberg<0.11.0,>=0.8.1; extra == 'iceberg'
41
41
  Provides-Extra: mcp
42
- Requires-Dist: fastmcp>=2.12.3; extra == 'mcp'
42
+ Requires-Dist: fastmcp<2.14.0,>=2.12.3; extra == 'mcp'
43
43
  Provides-Extra: pandas
44
- Requires-Dist: pandas>=2.2.3; extra == 'pandas'
44
+ Requires-Dist: pandas<2.4.0,>=2.2.3; extra == 'pandas'
45
45
  Provides-Extra: scale-data-generator
46
- Requires-Dist: faker>=37.1.0; extra == 'scale-data-generator'
47
- Requires-Dist: numpy<3.0.0,>=1.23.5; extra == 'scale-data-generator'
48
- Requires-Dist: pandas>=2.2.3; extra == 'scale-data-generator'
49
- Requires-Dist: pyarrow>=20.0.0; extra == 'scale-data-generator'
50
- Requires-Dist: pyyaml>=6.0.2; extra == 'scale-data-generator'
46
+ Requires-Dist: faker<38.3.0,>=37.1.0; extra == 'scale-data-generator'
47
+ Requires-Dist: numpy<2.4.0,>=1.23.5; extra == 'scale-data-generator'
48
+ Requires-Dist: pandas<2.4.0,>=2.2.3; extra == 'scale-data-generator'
49
+ Requires-Dist: pyarrow<23.0.0,>=20.0.0; extra == 'scale-data-generator'
50
+ Requires-Dist: pyyaml<6.1.0,>=6.0.2; extra == 'scale-data-generator'
51
51
  Provides-Extra: sqlalchemy
52
- Requires-Dist: sqlalchemy[asyncio]>=2.0.36; extra == 'sqlalchemy'
52
+ Requires-Dist: sqlalchemy[asyncio]<2.1.0,>=2.0.36; extra == 'sqlalchemy'
53
53
  Provides-Extra: tests
54
- Requires-Dist: pandas>=2.2.3; extra == 'tests'
55
- Requires-Dist: pandera[io]>=0.23.1; extra == 'tests'
56
- Requires-Dist: pytest-order>=1.3.0; extra == 'tests'
54
+ Requires-Dist: pandas<2.4.0,>=2.2.3; extra == 'tests'
55
+ Requires-Dist: pandera[io]<0.28.0,>=0.23.1; extra == 'tests'
56
+ Requires-Dist: pytest-order<1.4.0,>=1.3.0; extra == 'tests'
57
57
  Provides-Extra: workflows
58
58
  Requires-Dist: dapr==1.16.0; extra == 'workflows'
59
- Requires-Dist: orjson>=3.10.18; extra == 'workflows'
60
- Requires-Dist: temporalio>=1.7.1; extra == 'workflows'
59
+ Requires-Dist: orjson<3.12.0,>=3.10.18; extra == 'workflows'
60
+ Requires-Dist: temporalio<1.21.0,>=1.7.1; extra == 'workflows'
61
61
  Description-Content-Type: text/markdown
62
62
 
63
63
  # Atlan Application SDK
@@ -1,6 +1,6 @@
1
1
  application_sdk/__init__.py,sha256=2e2mvmLJ5dxmJGPELtb33xwP-j6JMdoIuqKycEn7hjg,151
2
2
  application_sdk/constants.py,sha256=S3I_WUGFbmAPH5GTtoTKD5rxILGevkZ219zhctLQles,11568
3
- application_sdk/version.py,sha256=n8PqKFL55s3jQOUeZaIikneMkvHfl5rDvs8kIXEHDfc,84
3
+ application_sdk/version.py,sha256=akVgygs1oN8Lt6vnP-2pwB8oyNGN15XLpIPgkgIHleA,84
4
4
  application_sdk/worker.py,sha256=D3-wtfGv1DLFKi1YSaE3jTcX66eC00N6RwtBu9RkgNc,7555
5
5
  application_sdk/activities/__init__.py,sha256=L5WXkTwOwGtjWAlXrUJRCKGwyIyp3z8fBv8BZVCRFQI,11175
6
6
  application_sdk/activities/lock_management.py,sha256=6Wdf3jMKitoarHQP91PIJOoGFz4aaOLS_40c7n1yAOA,3902
@@ -11,7 +11,7 @@ application_sdk/activities/common/utils.py,sha256=nSNGkY5eS5pPc8etdPWkXBFTSaConG
11
11
  application_sdk/activities/metadata_extraction/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  application_sdk/activities/metadata_extraction/base.py,sha256=ENFojpxqKdN_eVSL4iet3cGfylPOfcl1jnflfo4zhs8,3920
13
13
  application_sdk/activities/metadata_extraction/rest.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- application_sdk/activities/metadata_extraction/sql.py,sha256=0nma1lQned2K7VUmBK_GIPDjt3iU7mRGFvdxxmm80ec,34436
14
+ application_sdk/activities/metadata_extraction/sql.py,sha256=jD4lzg89jpWWxX7yI5bfsIbJ5RzNtFZiUapWq2z-M8Q,34453
15
15
  application_sdk/activities/query_extraction/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  application_sdk/activities/query_extraction/sql.py,sha256=l64cGyTmbtaGcg3qj1YXKyNWiWeRsWPEuQyqW06rxxQ,21165
17
17
  application_sdk/application/__init__.py,sha256=hb5zBc4zi-10av8Ivbovhb0CEAwNgr3eFlfpRaMKVmI,9861
@@ -71,13 +71,13 @@ application_sdk/interceptors/events.py,sha256=TeStWmBbc4v1-dm2DWeKYsUfUhJLR8CtTQ
71
71
  application_sdk/interceptors/lock.py,sha256=5ETm20zrTaH2b9fepN4Ckp1tGJV-uINqDrno_5RW3aw,6169
72
72
  application_sdk/interceptors/.cursor/BUGBOT.md,sha256=pxmUF2c7dtaXAX8yAa1-LBa6FCrj_uw7aQcHrppjf1A,14570
73
73
  application_sdk/observability/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- application_sdk/observability/logger_adaptor.py,sha256=00c0F7maDkp1xrHttW6VQbWFDGr6NkXeDPjmf97ojlY,29989
74
+ application_sdk/observability/logger_adaptor.py,sha256=X2elwgGxUlcpdQDtIF0pVigML6STyKJ8ausftLjbw10,30310
75
75
  application_sdk/observability/metrics_adaptor.py,sha256=5Oz02lUED60duryoVDF9mbD11fpxhbXi7P1609n_15Y,16446
76
76
  application_sdk/observability/observability.py,sha256=MGxNFPx6pOdpWrpNXZp44NPk3SG4xjA9cKrTeZ1ENK8,23681
77
77
  application_sdk/observability/traces_adaptor.py,sha256=0eQJPN-tYA_dV8D3uEa5ZiX9g12NDuLnPaFuQMVDdL0,18242
78
78
  application_sdk/observability/utils.py,sha256=JoHEA68cjkXTnAXHzgiULYOzRTk8rG4kPZRvFYah3aU,2505
79
79
  application_sdk/observability/decorators/observability_decorator.py,sha256=yd6qfrg1MmH5KcZ5Ydzb0RaBzmxx5FrmiI9qwvZx3EU,8963
80
- application_sdk/outputs/__init__.py,sha256=dekaEqJEVAmXQYSy_AohXOHNNI56OXG3Xn27FFRmoPQ,15926
80
+ application_sdk/outputs/__init__.py,sha256=_n54Fj_VwGGwOpGQk9atvUw3-fd6GMOjd5-Jx-0TpZs,16836
81
81
  application_sdk/outputs/iceberg.py,sha256=TdppOMEMfojMhGyBmhWeu1AJQexRyHM-huAYeJmhjdY,5533
82
82
  application_sdk/outputs/json.py,sha256=gYDDNOVb8EFxxeOkb6zKWZWjTEVgZLoapFM97_roK4A,10883
83
83
  application_sdk/outputs/parquet.py,sha256=DxcKh1IXPdiXNQJS1HIn6-JRdLkmN4At8uF1zppiZX0,20762
@@ -157,8 +157,8 @@ application_sdk/workflows/metadata_extraction/__init__.py,sha256=jHUe_ZBQ66jx8bg
157
157
  application_sdk/workflows/metadata_extraction/sql.py,sha256=6ZaVt84n-8U2ZvR9GR7uIJKv5v8CuyQjhlnoRJvDszc,12435
158
158
  application_sdk/workflows/query_extraction/__init__.py,sha256=n066_CX5RpJz6DIxGMkKS3eGSRg03ilaCtsqfJWQb7Q,117
159
159
  application_sdk/workflows/query_extraction/sql.py,sha256=kT_JQkLCRZ44ZpaC4QvPL6DxnRIIVh8gYHLqRbMI-hA,4826
160
- atlan_application_sdk-1.0.0.dist-info/METADATA,sha256=swGd9pU5apj6q4fOgxwiJOhDYG4flMcywkQyp5ZPnVA,5726
161
- atlan_application_sdk-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
162
- atlan_application_sdk-1.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
163
- atlan_application_sdk-1.0.0.dist-info/licenses/NOTICE,sha256=A-XVVGt3KOYuuMmvSMIFkg534F1vHiCggEBp4Ez3wGk,1041
164
- atlan_application_sdk-1.0.0.dist-info/RECORD,,
160
+ atlan_application_sdk-1.0.2.dist-info/METADATA,sha256=fEbew4WYY-qIhqeREuvwZQptBYlBKLSzUqbEvxPmcmo,5913
161
+ atlan_application_sdk-1.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
162
+ atlan_application_sdk-1.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
163
+ atlan_application_sdk-1.0.2.dist-info/licenses/NOTICE,sha256=A-XVVGt3KOYuuMmvSMIFkg534F1vHiCggEBp4Ez3wGk,1041
164
+ atlan_application_sdk-1.0.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any