atlan-application-sdk 0.1.1rc27__py3-none-any.whl → 0.1.1rc28__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.
- application_sdk/clients/atlan_client.py +70 -0
- application_sdk/constants.py +7 -0
- application_sdk/version.py +1 -1
- {atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/METADATA +2 -2
- {atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/RECORD +8 -7
- {atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/WHEEL +0 -0
- {atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/licenses/LICENSE +0 -0
- {atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pyatlan.client.atlan import AtlanClient
|
|
4
|
+
|
|
5
|
+
from application_sdk.common.error_codes import ClientError
|
|
6
|
+
from application_sdk.constants import (
|
|
7
|
+
ATLAN_API_KEY,
|
|
8
|
+
ATLAN_API_TOKEN_GUID,
|
|
9
|
+
ATLAN_BASE_URL,
|
|
10
|
+
ATLAN_CLIENT_ID,
|
|
11
|
+
ATLAN_CLIENT_SECRET,
|
|
12
|
+
)
|
|
13
|
+
from application_sdk.observability.logger_adaptor import get_logger
|
|
14
|
+
|
|
15
|
+
logger = get_logger(__name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_client(
|
|
19
|
+
base_url: Optional[str] = None,
|
|
20
|
+
api_key: Optional[str] = None,
|
|
21
|
+
api_token_guid: Optional[str] = None,
|
|
22
|
+
) -> AtlanClient:
|
|
23
|
+
"""
|
|
24
|
+
Returns an authenticated AtlanClient instance using provided parameters or environment variables.
|
|
25
|
+
|
|
26
|
+
Selects authentication method based on the presence of parameters or environment variables and validates the required configuration.
|
|
27
|
+
In general, the use of environment variables is recommended. Any parameters specified will override the environment variables.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
base_url: Atlan base URL (overrides ATLAN_BASE_URL)
|
|
31
|
+
api_key: Atlan API key (overrides ATLAN_API_KEY)
|
|
32
|
+
api_token_guid: API token GUID (overrides API_TOKEN_GUID)
|
|
33
|
+
"""
|
|
34
|
+
# Resolve final values (parameters override env vars)
|
|
35
|
+
final_token_guid = api_token_guid or ATLAN_API_TOKEN_GUID
|
|
36
|
+
final_base_url = base_url or ATLAN_BASE_URL
|
|
37
|
+
final_api_key = api_key or ATLAN_API_KEY
|
|
38
|
+
|
|
39
|
+
# Priority 1: Token-based auth (recommended for production)
|
|
40
|
+
if final_token_guid:
|
|
41
|
+
if final_base_url or final_api_key: # Check original params, not env vars
|
|
42
|
+
logger.warning(
|
|
43
|
+
"Token auth takes precedence - ignoring base_url/api_key parameters as well as ATLAN_BASE_URL and ATLAN_API_KEY environment variables."
|
|
44
|
+
)
|
|
45
|
+
return _get_client_from_token(final_token_guid)
|
|
46
|
+
|
|
47
|
+
# Priority 2: API key + base URL auth
|
|
48
|
+
if not final_base_url:
|
|
49
|
+
raise ClientError(
|
|
50
|
+
"ATLAN_BASE_URL is required (via parameter or environment variable)"
|
|
51
|
+
)
|
|
52
|
+
if not final_api_key:
|
|
53
|
+
raise ClientError(
|
|
54
|
+
"ATLAN_API_KEY is required (via parameter or environment variable)"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
logger.info("Using API key-based authentication")
|
|
58
|
+
return AtlanClient(base_url=final_base_url, api_key=final_api_key)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _get_client_from_token(api_token_guid: str):
|
|
62
|
+
if not ATLAN_CLIENT_ID:
|
|
63
|
+
raise ClientError(
|
|
64
|
+
f"{ClientError.AUTH_CONFIG_ERROR}: Environment variable CLIENT_ID is required when API_TOKEN_GUID is set."
|
|
65
|
+
)
|
|
66
|
+
if not ATLAN_CLIENT_SECRET:
|
|
67
|
+
raise ClientError(
|
|
68
|
+
f"{ClientError.AUTH_CONFIG_ERROR}: Environment variable CLIENT_SECRET is required when API_TOKEN_GUID is set."
|
|
69
|
+
)
|
|
70
|
+
return AtlanClient.from_token_guid(guid=api_token_guid)
|
application_sdk/constants.py
CHANGED
|
@@ -217,3 +217,10 @@ TRACES_FILE_NAME = "traces.parquet"
|
|
|
217
217
|
ENABLE_OBSERVABILITY_DAPR_SINK = (
|
|
218
218
|
os.getenv("ATLAN_ENABLE_OBSERVABILITY_DAPR_SINK", "false").lower() == "true"
|
|
219
219
|
)
|
|
220
|
+
|
|
221
|
+
# atlan_client configuration (non ATLAN_ prefix are rooted in pyatlan SDK, to be revisited)
|
|
222
|
+
ATLAN_API_TOKEN_GUID = os.getenv("API_TOKEN_GUID")
|
|
223
|
+
ATLAN_BASE_URL = os.getenv("ATLAN_BASE_URL")
|
|
224
|
+
ATLAN_API_KEY = os.getenv("ATLAN_API_KEY")
|
|
225
|
+
ATLAN_CLIENT_ID = os.getenv("CLIENT_ID")
|
|
226
|
+
ATLAN_CLIENT_SECRET = os.getenv("CLIENT_SECRET")
|
application_sdk/version.py
CHANGED
{atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: atlan-application-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1rc28
|
|
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
|
|
@@ -26,7 +26,7 @@ Requires-Dist: fastapi[standard]>=0.115.0
|
|
|
26
26
|
Requires-Dist: loguru>=0.7.3
|
|
27
27
|
Requires-Dist: opentelemetry-exporter-otlp>=1.27.0
|
|
28
28
|
Requires-Dist: psutil>=7.0.0
|
|
29
|
-
Requires-Dist: pyatlan>=7.1.
|
|
29
|
+
Requires-Dist: pyatlan>=7.1.6
|
|
30
30
|
Requires-Dist: pydantic>=2.10.6
|
|
31
31
|
Requires-Dist: python-dotenv>=1.1.0
|
|
32
32
|
Requires-Dist: uvloop>=0.21.0; sys_platform != 'win32'
|
{atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
application_sdk/__init__.py,sha256=2e2mvmLJ5dxmJGPELtb33xwP-j6JMdoIuqKycEn7hjg,151
|
|
2
|
-
application_sdk/constants.py,sha256=
|
|
3
|
-
application_sdk/version.py,sha256=
|
|
2
|
+
application_sdk/constants.py,sha256=Npmw6ojj731faIE3BMeXE5bucxWFkAD13cYx5cQ9PZw,9302
|
|
3
|
+
application_sdk/version.py,sha256=dAt_fXyCvt-5sLv5kCnHWbaTLVTYgdCQ1V7EoOwVJDU,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
|
|
@@ -15,6 +15,7 @@ application_sdk/application/__init__.py,sha256=wCaAsoQ-wIYtfeG6hNwwLi8PcufjwMBjm
|
|
|
15
15
|
application_sdk/application/metadata_extraction/sql.py,sha256=ohpV4qZ92uKRlH7I_8G67ocnWkZJAZCU_7XdvqYPiN4,7966
|
|
16
16
|
application_sdk/clients/__init__.py,sha256=C9T84J7V6ZumcoWJPAxdd3tqSmbyciaGBJn-CaCCny0,1341
|
|
17
17
|
application_sdk/clients/atlan_auth.py,sha256=MQznmvVKrlOT_Tp232W4UrOupRrx9Dx9zQm3n1R7kD8,8938
|
|
18
|
+
application_sdk/clients/atlan_client.py,sha256=f2-Uk5KiPIDJEhGkfYctA_f3CwoVB_mWNBMVvxeLuY4,2684
|
|
18
19
|
application_sdk/clients/sql.py,sha256=tW89SHuuWdU5jv8lDUP5AUCEpR2CF_5TyUvYDCBHses,17880
|
|
19
20
|
application_sdk/clients/temporal.py,sha256=kiB9W2e3x6gGtFC9e7vqTIBNGbt7nyS6p7j2hLKdsgI,22364
|
|
20
21
|
application_sdk/clients/utils.py,sha256=zLFOJbTr_6TOqnjfVFGY85OtIXZ4FQy_rquzjaydkbY,779
|
|
@@ -129,8 +130,8 @@ application_sdk/workflows/metadata_extraction/__init__.py,sha256=jHUe_ZBQ66jx8bg
|
|
|
129
130
|
application_sdk/workflows/metadata_extraction/sql.py,sha256=_NhszxIgmcQI6lVpjJoyJRFLwPYvJw1Dyqox_m9K2RA,11947
|
|
130
131
|
application_sdk/workflows/query_extraction/__init__.py,sha256=n066_CX5RpJz6DIxGMkKS3eGSRg03ilaCtsqfJWQb7Q,117
|
|
131
132
|
application_sdk/workflows/query_extraction/sql.py,sha256=kT_JQkLCRZ44ZpaC4QvPL6DxnRIIVh8gYHLqRbMI-hA,4826
|
|
132
|
-
atlan_application_sdk-0.1.
|
|
133
|
-
atlan_application_sdk-0.1.
|
|
134
|
-
atlan_application_sdk-0.1.
|
|
135
|
-
atlan_application_sdk-0.1.
|
|
136
|
-
atlan_application_sdk-0.1.
|
|
133
|
+
atlan_application_sdk-0.1.1rc28.dist-info/METADATA,sha256=wAdmNUPLPieA06duXajVG_NdweyzxwZMA60mDYShTXc,5473
|
|
134
|
+
atlan_application_sdk-0.1.1rc28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
135
|
+
atlan_application_sdk-0.1.1rc28.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
136
|
+
atlan_application_sdk-0.1.1rc28.dist-info/licenses/NOTICE,sha256=A-XVVGt3KOYuuMmvSMIFkg534F1vHiCggEBp4Ez3wGk,1041
|
|
137
|
+
atlan_application_sdk-0.1.1rc28.dist-info/RECORD,,
|
{atlan_application_sdk-0.1.1rc27.dist-info → atlan_application_sdk-0.1.1rc28.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|