Skip to content

Commit 732676c

Browse files
committed
fix: updated azure.py
1 parent 50574bd commit 732676c

File tree

5 files changed

+33
-10
lines changed

5 files changed

+33
-10
lines changed

application_sdk/clients/azure/azure.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from application_sdk.clients import ClientInterface
1717
from application_sdk.clients.azure.azure_auth import AzureAuthProvider
18-
from application_sdk.common.credential_utils import resolve_credentials
1918
from application_sdk.common.error_codes import ClientError
2019
from application_sdk.observability.logger_adaptor import get_logger
2120

@@ -82,8 +81,30 @@ async def load(self, credentials: Optional[Dict[str, Any]] = None) -> None:
8281
try:
8382
logger.info("Loading Azure client...")
8483

85-
# Resolve credentials using framework's credential resolution
86-
self.resolved_credentials = await resolve_credentials(self.credentials)
84+
# Handle credential resolution
85+
if "credential_guid" in self.credentials:
86+
# If we have a credential_guid, use the async get_credentials function
87+
from application_sdk.common.credential_utils import get_credentials
88+
89+
self.resolved_credentials = await get_credentials(
90+
self.credentials["credential_guid"]
91+
)
92+
else:
93+
# If credentials are already resolved (direct format), use them as-is
94+
# For direct credentials, we need to check if they need resolution
95+
if (
96+
"secret-path" in self.credentials
97+
or "credentialSource" in self.credentials
98+
):
99+
# Credentials need resolution - this is a complex case
100+
# For now, assume credentials are already resolved if no credential_guid
101+
logger.warning(
102+
"Credentials appear to need resolution but no credential_guid provided. Using as-is."
103+
)
104+
self.resolved_credentials = self.credentials
105+
else:
106+
# Credentials are already in the correct format
107+
self.resolved_credentials = self.credentials
87108

88109
# Create Azure credential using Service Principal authentication
89110
self.credential = await self.auth_provider.create_credential(

application_sdk/common/credential_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def _get_credentials_sync(credential_guid: str) -> Dict[str, Any]:
5959
f"Failed to resolve credentials: {str(e)}",
6060
)
6161

62+
6263
def resolve_credentials(
6364
credential_config: Dict[str, Any], secret_data: Dict[str, Any]
6465
) -> Dict[str, Any]:
@@ -81,4 +82,4 @@ def resolve_credentials(
8182
elif value in secret_data.get("extra", {}):
8283
credentials["extra"][key] = secret_data["extra"][value]
8384

84-
return credentials
85+
return credentials

application_sdk/transformers/common/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ def flatten_yaml_columns(
139139
flat_columns: List[Dict[str, Any]] = []
140140
for key, value in nested.items():
141141
new_key = f"{parent_key}{sep}{key}" if parent_key else key
142-
143142
if isinstance(value, dict) and any(isinstance(v, dict) for v in value.values()):
144143
# If value is a dict and has nested dicts, recurse
145144
flat_columns.extend(flatten_yaml_columns(value, new_key, sep=sep))
@@ -150,5 +149,4 @@ def flatten_yaml_columns(
150149
)
151150
col_def["name"] = new_key
152151
flat_columns.append(col_def)
153-
154152
return flat_columns

application_sdk/transformers/query/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,17 @@ def _build_struct(self, level: dict, prefix: str = "") -> Optional[daft.Expressi
208208
logger.info(f"=== DEBUG: _build_struct called ===")
209209
logger.info(f"level: {level} (type: {type(level)})")
210210
logger.info(f"prefix: {prefix} (type: {type(prefix)})")
211-
211+
212212
# Check if level is None
213213
if level is None:
214214
logger.error("ERROR: level is None in _build_struct!")
215215
raise ValueError("level cannot be None in _build_struct")
216-
216+
217217
# Check if prefix is None
218218
if prefix is None:
219219
logger.error("ERROR: prefix is None in _build_struct!")
220220
raise ValueError("prefix cannot be None in _build_struct")
221-
221+
222222
struct_fields = []
223223
non_null_fields = []
224224

@@ -312,7 +312,7 @@ def get_grouped_dataframe_by_prefix(
312312
if col is None:
313313
logger.error(f"Found None column in DataFrame columns: {columns}")
314314
continue
315-
315+
316316
if "." in col:
317317
# Split the full path into components
318318
path_components = col.split(".")

uv.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)