You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that cq should be framework/tools agnostic, however I caught myself couple of times running from cq.models import Event within my Django based app.
We should be able to query events in a much better manner. To be specific I would love to be able to query events with explicit ordering and filtering after doing simple library import.
Basically, I'd like to achieve something like:
importcqforeventincq.query_events('User.StartedSession', limit=50):
print("{} | User {} logged in".format(event.ts, event.data['email']))
names are not named arguments. Might be empty of course - in this case all events, regardless of their types, would be returned
limit results to first 100 by default. If None given, all matching events are returned
order_by defaults to -ts, meaning events would be ordered by date of creation, descending. Allows to change or disable order.
filters: For now it would probably suffice to filter by ts param. It should be similar to what is possible with Django ORM: ts=datetime(2017, 3, 24) (exact comparison) or ts__gte=datetime(2017, 3, 24) (all events created after 2017-03-24) or ts="day" (if string given, should be human readable and would be treated as "show me events from last day/week/month" or number of those like "2 weeks". I'd say this is optional, however I'd strongly advice to implement it as it would be mostly used in my opinion).
The text was updated successfully, but these errors were encountered:
I believe that
cq
should be framework/tools agnostic, however I caught myself couple of times runningfrom cq.models import Event
within my Django based app.We should be able to query events in a much better manner. To be specific I would love to be able to query events with explicit ordering and filtering after doing simple library import.
Basically, I'd like to achieve something like:
Or something like:
which should show events from last 3 days.
Signature of
cq.query_events
names
are not named arguments. Might be empty of course - in this case all events, regardless of their types, would be returnedlimit
results to first 100 by default. IfNone
given, all matching events are returnedorder_by
defaults to-ts
, meaning events would be ordered by date of creation, descending. Allows to change or disable order.filters
: For now it would probably suffice to filter byts
param. It should be similar to what is possible with Django ORM:ts=datetime(2017, 3, 24)
(exact comparison) orts__gte=datetime(2017, 3, 24)
(all events created after 2017-03-24) orts="day"
(if string given, should be human readable and would be treated as "show me events from last day/week/month" or number of those like "2 weeks". I'd say this is optional, however I'd strongly advice to implement it as it would be mostly used in my opinion).The text was updated successfully, but these errors were encountered: