pvw-cli 1.0.8__py3-none-any.whl → 1.0.10__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.

Potentially problematic release.


This version of pvw-cli might be problematic. Click here for more details.

@@ -9,7 +9,7 @@ from .endpoints import ENDPOINTS, format_endpoint, get_api_version_params
9
9
  class Workflow(Endpoint):
10
10
  def __init__(self):
11
11
  Endpoint.__init__(self)
12
- self.app = 'workflow'
12
+ self.app = 'datagovernance' # Use datagovernance for workflow endpoints
13
13
 
14
14
  # ========== Workflow Management ==========
15
15
 
@@ -17,8 +17,8 @@ class Workflow(Endpoint):
17
17
  def workflowListWorkflows(self, args):
18
18
  """List all workflows"""
19
19
  self.method = 'GET'
20
- self.endpoint = ENDPOINTS['workflow']['list_workflows']
21
- self.params = get_api_version_params('workflow')
20
+ self.endpoint = '/datagovernance/dataaccess/workflows'
21
+ self.params = {}
22
22
 
23
23
  @decorator
24
24
  def workflowCreateWorkflow(self, args):
@@ -37,6 +37,21 @@ def get_data(http_dict):
37
37
  client = SyncPurviewClient(config)
38
38
 
39
39
  # Make the request
40
+ # If debug enabled via PURVIEWCLI_DEBUG env var, print helpful diagnostics
41
+ debug = os.getenv("PURVIEWCLI_DEBUG")
42
+ if debug:
43
+ try:
44
+ base_info = {
45
+ "app": http_dict.get("app"),
46
+ "method": http_dict.get("method", "GET"),
47
+ "endpoint": http_dict.get("endpoint", "/"),
48
+ "params": http_dict.get("params"),
49
+ "payload": http_dict.get("payload"),
50
+ }
51
+ print("[PURVIEWCLI DEBUG] Request:", json.dumps(base_info, default=str, indent=2))
52
+ except Exception:
53
+ print("[PURVIEWCLI DEBUG] Request: (could not serialize request info)")
54
+
40
55
  result = client.make_request(
41
56
  method=http_dict.get("method", "GET"),
42
57
  endpoint=http_dict.get("endpoint", "/"),
@@ -44,6 +59,12 @@ def get_data(http_dict):
44
59
  json=http_dict.get("payload"),
45
60
  )
46
61
 
62
+ if debug:
63
+ try:
64
+ print("[PURVIEWCLI DEBUG] Response:", json.dumps(result, default=str, indent=2))
65
+ except Exception:
66
+ print("[PURVIEWCLI DEBUG] Response: (could not serialize response)")
67
+
47
68
  # The synchronous client returns a wrapper dict like
48
69
  # {"status": "success", "data": <json>, "status_code": 200}
49
70
  # Normalize to return the raw JSON payload when available so
@@ -60,21 +60,21 @@ class SyncPurviewClient:
60
60
  "-o", "tsv"
61
61
  ], capture_output=True, text=True, check=True)
62
62
  atlas_url = result.stdout.strip()
63
- # Extract account ID from URL like: https://c869cf92-11d8-4fbc-a7cf-6114d160dd71-api.purview-service.microsoft.com/catalog
63
+
64
64
  if atlas_url and "-api.purview-service.microsoft.com" in atlas_url:
65
65
  account_id = atlas_url.split("://")[1].split("-api.purview-service.microsoft.com")[0]
66
66
  else:
67
67
  raise Exception(f"Could not extract account ID from Atlas URL: {atlas_url}")
68
68
  except Exception as e:
69
- # Try to get tenant ID as fallback since it often matches the account ID
69
+ # For Unified Catalog, the account ID is typically the Azure Tenant ID
70
70
  try:
71
71
  tenant_result = subprocess.run([
72
72
  "az", "account", "show", "--query", "tenantId", "-o", "tsv"
73
73
  ], capture_output=True, text=True, check=True)
74
74
  account_id = tenant_result.stdout.strip()
75
- print(f"Warning: Using tenant ID as account ID fallback: {account_id}")
75
+ print(f"Info: Using Tenant ID as Purview Account ID for Unified Catalog: {account_id}")
76
76
  except Exception:
77
- raise Exception(f"Could not determine Purview account ID. Please set PURVIEW_ACCOUNT_ID environment variable. Error: {e}")
77
+ raise Exception(f"Could not determine Purview account ID. For Unified Catalog, this is typically your Azure Tenant ID. Please set PURVIEW_ACCOUNT_ID environment variable. Error: {e}")
78
78
  return account_id
79
79
 
80
80
  def _get_authentication_token(self, for_unified_catalog=False):
@@ -113,8 +113,13 @@ class SyncPurviewClient:
113
113
  def make_request(self, method: str, endpoint: str, **kwargs) -> Dict:
114
114
  """Make actual HTTP request to Microsoft Purview"""
115
115
  try:
116
- # Determine if this is a Unified Catalog request
117
- is_unified_catalog = endpoint.startswith('/datagovernance/catalog')
116
+ # Determine if this is a Unified Catalog / Data Map (Atlas) request
117
+ # Several endpoints use '/catalog' or '/datamap' prefixes (Atlas/DataMap APIs)
118
+ is_unified_catalog = (
119
+ endpoint.startswith('/datagovernance/catalog')
120
+ or endpoint.startswith('/catalog')
121
+ or endpoint.startswith('/datamap')
122
+ )
118
123
 
119
124
  # Get the appropriate authentication token and base URL
120
125
  if is_unified_catalog:
@@ -146,7 +151,7 @@ class SyncPurviewClient:
146
151
  timeout=30,
147
152
  )
148
153
  # Handle the response
149
- if response.status_code == 200:
154
+ if response.status_code in [200, 201]:
150
155
  try:
151
156
  data = response.json()
152
157
  return {"status": "success", "data": data, "status_code": response.status_code}
@@ -172,7 +177,7 @@ class SyncPurviewClient:
172
177
  timeout=30,
173
178
  )
174
179
 
175
- if response.status_code == 200:
180
+ if response.status_code in [200, 201]:
176
181
  try:
177
182
  data = response.json()
178
183
  return {