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

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

                Author: ASF GitHub Bot
            Created on: 27/Jun/19 13:45
            Start Date: 27/Jun/19 13:45
    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_r298184969
 
 

 ##########
 File path: sdks/python/apache_beam/io/gcp/datastore/v1new/types_test.py
 ##########
 @@ -134,6 +135,36 @@ def testQuery(self):
 
     logging.info('query: %s', q)  # Test __repr__()
 
+  def testRuntimeFilters(self):
+    filter_list = [
+        [(StaticValueProvider(str, 'property_name'),  # Filter 1
+          StaticValueProvider(str, '='),
+          StaticValueProvider(str, 'value'))],
+        [(StaticValueProvider(str, 'property_name'),  # Filter 2(1)
+          StaticValueProvider(str, '='),
+          StaticValueProvider(str, 'value')),
+         ('property_name', '=', 'value')],  # Filter 2(2)
+    ]
+    for filters in filter_list:
+      projection = ['f1', 'f2']
+      order = projection
+      distinct_on = projection
+      ancestor_key = Key(['kind', 'id'], project=self._PROJECT)
+      q = Query(kind='kind', project=self._PROJECT, namespace=self._NAMESPACE,
+                ancestor=ancestor_key, filters=filters, projection=projection,
+                order=order, distinct_on=distinct_on)
+      cq = q._to_client_query(self._test_client)
 
 Review comment:
   Thanks for the feedback! I've updated the test to test:
   `[(ValueProvider)] == [(str-filter)]`
   
   and a composite filter of:
   `[(ValueProvider), (str-filter)] == [(str-filter), (str-filter)]`
 
----------------------------------------------------------------
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: 268536)
    Time Spent: 1.5h  (was: 1h 20m)

> 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
>            Priority: Minor
>          Time Spent: 1.5h
>  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