okirialbert commented on code in PR #37602:
URL: https://github.com/apache/airflow/pull/37602#discussion_r1498578487
##########
airflow/models/xcom.py:
##########
@@ -785,19 +801,26 @@ def __getstate__(self) -> Any:
return (str(statement), query.count())
def __setstate__(self, state: Any) -> None:
+ """Construct a query by retrieving the statement from the `state` and
assign it to the `self._query`class property."""
statement, self._len = state
self._query = Query(XCom.value).from_statement(text(statement))
def __len__(self):
+ """Declare a `self._len` class property that assigns the number of
rows the query returns using `query.count()` if the `self._len` property is
`None`.
+
+ Otherwise return `self._len`
+ """
if self._len is None:
with self._get_bound_query() as query:
self._len = query.count()
return self._len
def __iter__(self):
+ """Return a `_LazyXComAccessIterator` class instance to manage query
sessions."""
Review Comment:
Noted. I'll make the changes.
--
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]