[ 
https://issues.apache.org/jira/browse/BEAM-7577?focusedWorklogId=272140&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-272140
 ]

ASF GitHub Bot logged work on BEAM-7577:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jul/19 11:16
            Start Date: 04/Jul/19 11:16
    Worklog Time Spent: 10m 
      Work Description: EDjur commented on pull request #8950: [BEAM-7577] 
Allow ValueProviders in Datastore Query filters
URL: https://github.com/apache/beam/pull/8950#discussion_r300351754
 
 

 ##########
 File path: sdks/python/apache_beam/io/gcp/datastore/v1new/types.py
 ##########
 @@ -84,6 +89,30 @@ def _to_client_query(self, client):
   def clone(self):
     return copy.copy(self)
 
+  def _set_runtime_filters(self):
+    """
+    Extracts values from ValueProviders in `self.filters` if available
+    :param filters: sequence of tuple[str, str, str] or
+    sequence of tuple[ValueProvider, ValueProvider, ValueProvider]
 
 Review comment:
   Been thinking more about this today and have a question regarding 
ValueProviders.
   
   Say I have a GCP Cloud Function that starts my Dataflow job using the 
template I've staged. This function can pass parameters to the template that 
would specify a runtime filter that I want to apply when I ReadFromDatastore.
   
   When executing the template by using an API call, I cannot provide a fully 
qualified ValueProvider object as a parameter, I can only use strings as 
parameters. This was the reason I originally used `sequence of 
tuple[ValueProvider, ValueProvider, ValueProvider]`.
   
   When using a `ValueProvider[tuple[str, str, str]]`, I'm not sure if there is 
a clean way (other than ast.literal_eval but we should avoid that) to 
instantiate it using strings received as arguments to the Dataflow template.
   
   I might be misunderstanding exactly how ValueProviders work, but is it 
possible to instantiate a `ValueProvider[tuple[str, str, str]]` where the 
strings in the filter would be determined at runtime, say e.g. through an API 
call?
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 272140)
    Time Spent: 4h 10m  (was: 4h)

> Allow the use of ValueProviders in 
> datastore.v1new.datastoreio.ReadFromDatastore query
> --------------------------------------------------------------------------------------
>
>                 Key: BEAM-7577
>                 URL: https://issues.apache.org/jira/browse/BEAM-7577
>             Project: Beam
>          Issue Type: New Feature
>          Components: io-python-gcp
>    Affects Versions: 2.13.0
>            Reporter: EDjur
>            Assignee: EDjur
>            Priority: Minor
>          Time Spent: 4h 10m
>  Remaining Estimate: 0h
>
> The current implementation of ReadFromDatastore does not support specifying 
> the query parameter at runtime. This could potentially be fixed through the 
> usage of a ValueProvider to specify and build the Datastore query.
> Allowing specifying the query at runtime makes it easier to use dynamic 
> queries in Dataflow templates. Currently, there is no way to have a Dataflow 
> template that includes a dynamic query (such as filtering by a timestamp or 
> similar).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to