GayathriSrividya commented on code in PR #67973:
URL: https://github.com/apache/airflow/pull/67973#discussion_r3386150468


##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -626,24 +626,17 @@ def row_value(self, row: Any, name: str) -> Any:
         Extract the sort-key value for ``name`` from a result row.
 
         Resolves the accessor through ``to_replace`` for string aliases
-        (e.g. ``{"dag_run_id": "run_id"}``); otherwise reads ``name`` directly.
+        (e.g. ``{"dag_run_id": "run_id"}``). For column-form mappings
+        (e.g. ``{"run_after": DagRun.run_after}``), we fall back to the
+        original attribute name so association proxies on the primary model can
+        still be used for cursor values.
         """
         if self.to_replace:
             replacement = self.to_replace.get(name)
             if isinstance(replacement, str):
                 return getattr(row, replacement, None)
             if replacement is not None:
-                # TODO: Column-form ``to_replace`` (e.g. ``{"last_run_state": 
DagRun.state}``)
-                # isn't supported for cursor pagination — no endpoint that 
uses cursor
-                # pagination needs it today. When one does, decide how the row 
exposes the
-                # value (projected label on the SELECT, eagerly loaded 
relationship, etc.)
-                # and wire it up here. Raising loudly so a future caller 
doesn't silently
-                # get ``None`` cursor tokens.
-                raise NotImplementedError(
-                    f"Cursor pagination does not support column-form 
``to_replace`` mapping for "
-                    f"``{name}``. Use a string alias in ``to_replace`` or sort 
by a primary-model "
-                    f"attribute."
-                )
+                return getattr(row, name, None)

Review Comment:
   - Applied reviewer's suggested [try/except 
AttributeError](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
 code change in 
[parameters.py](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
   - Added tests covering both paths: attribute resolves 
([run_after](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html))
 and attribute absent 
([data_interval_start](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html))
 raises 
[NotImplementedError](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
   - Added endpoint-level cursor roundtrip test for 
[order_by=-run_after](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
   - ruff format + ruff check pass on all changed files



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to