1818from google .cloud .firestore_v1 .base_pipeline import _BasePipeline
1919
2020if TYPE_CHECKING : # pragma: NO COVER
21+ import datetime
2122 from google .cloud .firestore_v1 .client import Client
2223 from google .cloud .firestore_v1 .pipeline_result import PipelineResult
2324 from google .cloud .firestore_v1 .transaction import Transaction
@@ -56,6 +57,7 @@ def __init__(self, client: Client, *stages: stages.Stage):
5657 def execute (
5758 self ,
5859 transaction : "Transaction" | None = None ,
60+ read_time : datetime .datetime | None = None ,
5961 ) -> list [PipelineResult ]:
6062 """
6163 Executes this pipeline and returns results as a list
@@ -67,12 +69,17 @@ def execute(
6769 If a ``transaction`` is used and it already has write operations
6870 added, this method cannot be used (i.e. read-after-write is not
6971 allowed).
72+ read_time (Optional[datetime.datetime]): If set, reads documents as they were at the given
73+ time. This must be a microsecond precision timestamp within the past one hour, or
74+ if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp
75+ within the past 7 days. For the most accurate results, use UTC timezone.
7076 """
71- return [result for result in self .stream (transaction = transaction )]
77+ return [result for result in self .stream (transaction = transaction , read_time = read_time )]
7278
7379 def stream (
7480 self ,
7581 transaction : "Transaction" | None = None ,
82+ read_time : datetime .datetime | None = None ,
7683 ) -> Iterable [PipelineResult ]:
7784 """
7885 Process this pipeline as a stream, providing results through an Iterable
@@ -84,7 +91,11 @@ def stream(
8491 If a ``transaction`` is used and it already has write operations
8592 added, this method cannot be used (i.e. read-after-write is not
8693 allowed).
94+ read_time (Optional[datetime.datetime]): If set, reads documents as they were at the given
95+ time. This must be a microsecond precision timestamp within the past one hour, or
96+ if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp
97+ within the past 7 days. For the most accurate results, use UTC timezone.
8798 """
88- request = self ._prep_execute_request (transaction )
99+ request = self ._prep_execute_request (transaction , read_time )
89100 for response in self ._client ._firestore_api .execute_pipeline (request ):
90101 yield from self ._execute_response_helper (response )
0 commit comments