|
54 | 54 | # MAGIC In Fabric Data Factory, the Web Activity output will be passed as a notebook parameter |
55 | 55 |
|
56 | 56 | # COMMAND ---------- |
57 | | -# Get the GitHub API response from pipeline parameter |
| 57 | +# PARAMETERS CELL: Define parameters that Data Factory will pass |
| 58 | +# This cell must be marked as "parameter cell" in Fabric (click ... → Toggle parameter cell) |
| 59 | +github_api_response = "" |
| 60 | + |
| 61 | +# COMMAND ---------- |
| 62 | +# Get the GitHub API response from Data Factory parameter |
58 | 63 | print("DEBUGGING: Checking for Data Factory pipeline parameters...") |
59 | | -github_response = None |
60 | 64 |
|
61 | | -try: |
62 | | - from notebookutils import mssparkutils |
63 | | - |
64 | | - # Get all parameters for debugging |
65 | | - params = mssparkutils.notebook.getParameters() |
66 | | - print(f"All available parameters: {list(params.keys())}") |
67 | | - |
68 | | - if 'github_api_response' in params: |
69 | | - github_response = params['github_api_response'] |
70 | | - print("SUCCESS: Found 'github_api_response' parameter") |
| 65 | +# Validate parameter from Data Factory |
| 66 | +if github_api_response and str(github_api_response).strip(): |
| 67 | + # Check if it's not just empty/null values |
| 68 | + if str(github_api_response).strip() not in ["null", "None", "{}", "[]", ""]: |
| 69 | + github_response = github_api_response |
| 70 | + print("SUCCESS: Found 'github_api_response' parameter from Data Factory") |
71 | 71 | print(f"Parameter type: {type(github_response)}") |
72 | 72 | print(f"Parameter length: {len(str(github_response))} characters") |
73 | | - |
74 | | - # Check if it's empty or just whitespace |
75 | | - if not github_response or str(github_response).strip() == "": |
76 | | - print("WARNING: Parameter exists but is empty or whitespace") |
77 | | - github_response = None |
78 | | - elif str(github_response).strip() in ["null", "None", "{}", "[]"]: |
79 | | - print("WARNING: Parameter contains null/empty values") |
80 | | - github_response = None |
81 | | - else: |
82 | | - print(f"SUCCESS: Valid parameter received: {str(github_response)[:200]}...") |
| 73 | + print(f"SUCCESS: Valid parameter received: {str(github_response)[:200]}...") |
83 | 74 | else: |
84 | | - print("ERROR: 'github_api_response' parameter not found") |
85 | | - |
86 | | - # Try alternative parameter names |
87 | | - alternative_names = ['github_response', 'api_response', 'web_activity_output'] |
88 | | - for alt_name in alternative_names: |
89 | | - if alt_name in params: |
90 | | - print(f"Found alternative parameter: {alt_name}") |
91 | | - github_response = params[alt_name] |
92 | | - break |
93 | | - |
94 | | -except Exception as e: |
95 | | - print(f"ERROR: Error accessing pipeline parameters: {e}") |
96 | | - raise |
| 75 | + print("WARNING: Parameter contains null/empty values") |
| 76 | + github_response = None |
| 77 | +else: |
| 78 | + print("ERROR: 'github_api_response' parameter not found or empty") |
| 79 | + github_response = None |
97 | 80 |
|
98 | 81 | # Final parameter validation |
99 | 82 | if github_response: |
|
0 commit comments