Query between datetime range on more than one columns using OR operator

19 views
Skip to first unread message

Yogic Rhama

unread,
Jul 20, 2022, 3:03:40 AM7/20/22
to Google Cloud Datastore
Hi, I have read the documentation but it didn't find OR operator. I need this kind of behaviour for querying data based on multiple timestamp column like create_at or update_at. Is there anyone know how to do this?

Sample query I want,
Select * from table_data where (update_at between "2021-02-20" AND "2021-03-20") OR
(create_at between "2021-02-20" AND "2021-03-20")

I am using python and wanna use this datastore query on my dataflow pipeline.

Jim Morrison

unread,
Jul 22, 2022, 4:39:59 PM7/22/22
to Yogic Rhama, Google Cloud Datastore
Hi Yogic,

 Until an OR operator is natively supported, you'll need to run one stage in Dataflow for your update_at query, one stage for create_at, then another stage to deduplicate the entities before processing your entities.  You might consider using key only requests for the queries since the key is enough to remove duplicates.

Thanks for the feature request.

Jim

--
You received this message because you are subscribed to the Google Groups "Google Cloud Datastore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gcd-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gcd-discuss/03572a7b-8286-4df3-9367-f9d8ecf68c84n%40googlegroups.com.


--
Jim
Reply all
Reply to author
Forward
0 new messages