API for deletion of events within a timerange?

Bug #799531 reported by Serhiy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Activity Log Manager
Invalid
Undecided
Unassigned
Zeitgeist Framework
In Progress
Wishlist
Trever Fischer

Bug Description

If I try to select date range more then a month it just freezes.

$ activity-log-manager
INFO:zeitgeist.client:Reconnected to Zeitgeist engine...
Error from Zeitgeist engine: org.freedesktop.DBus.Python.sqlite3.OperationalError: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/dbus/service.py", line 702, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/share/zeitgeist/_zeitgeist/engine/remote.py", line 337, in DeleteEvents
    timestamps = self._engine.delete_events(event_ids, sender=sender)
  File "/usr/share/zeitgeist/_zeitgeist/engine/main.py", line 838, in delete_events
    % ",".join(["?"] * len(ids)), ids)
  File "/usr/share/zeitgeist/_zeitgeist/engine/sql.py", line 74, in execute
    return super(UnicodeCursor, self).execute(statement, parameters)
OperationalError: too many SQL variables

Version: 0.8.0-0ubuntu1~ppa2~natty

Related branches

Revision history for this message
hdpq (defectoscopny) wrote :

Not a single reply since June? How sad.
I can confirm this bug, except that for me it occurs every time I try to clear history with date range of 1 day or more.
Setting it to 6 hours worked (but, obviously, it only removed the events from the last 6 hours).

Revision history for this message
Seif Lotfy (seif) wrote : Re: [Dev] [Bug 799531] Re: OperationalError: too many SQL variables

Sorry for the late reply...
We have 2 ways of solving this... Either handle the overload of
variables internally by doing it over several iterations or we lessen the
variables given by ALM. I will look into it this week.
Cheers
Seif

2011/9/4 hdpq <email address hidden>

> Not a single reply since June? How sad.
> I can confirm this bug, except that for me it occurs every time I try to
> clear history with date range of 1 day or more.
> Setting it to 6 hours worked (but, obviously, it only removed the events
> from the last 6 hours).
>
> --
> You received this bug notification because you are a member of Activity
> Log Manager, which is the registrant for Activity Log Manager.
> https://bugs.launchpad.net/bugs/799531
>
> Title:
> OperationalError: too many SQL variables
>
> Status in Activity Log Manager for Zeitgeist:
> New
>
> Bug description:
> If I try to select date range more then a month it just freezes.
>
> $ activity-log-manager
> INFO:zeitgeist.client:Reconnected to Zeitgeist engine...
> Error from Zeitgeist engine:
> org.freedesktop.DBus.Python.sqlite3.OperationalError: Traceback (most recent
> call last):
> File "/usr/lib/pymodules/python2.7/dbus/service.py", line 702, in
> _message_cb
> retval = candidate_method(self, *args, **keywords)
> File "/usr/share/zeitgeist/_zeitgeist/engine/remote.py", line 337, in
> DeleteEvents
> timestamps = self._engine.delete_events(event_ids, sender=sender)
> File "/usr/share/zeitgeist/_zeitgeist/engine/main.py", line 838, in
> delete_events
> % ",".join(["?"] * len(ids)), ids)
> File "/usr/share/zeitgeist/_zeitgeist/engine/sql.py", line 74, in
> execute
> return super(UnicodeCursor, self).execute(statement, parameters)
> OperationalError: too many SQL variables
>
> Version: 0.8.0-0ubuntu1~ppa2~natty
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/activity-log-manager/+bug/799531/+subscriptions
> _______________________________________________
> Dev mailing list
> <email address hidden>
> http://lists.zeitgeist-project.com/cgi-bin/mailman/listinfo/dev
>

Revision history for this message
Siegfried Gevatter (rainct) wrote : Re: OperationalError: too many SQL variables

Zeitgeist should be fixed to concatenate the ints directly instead of relying on SQLite to use its argument parsing (which has this limit on the number of arguments).

Additionally, maybe we should consider adding a proper API for deleting events within a time-range.

summary: - OperationalError: too many SQL variables
+ API for deletion of events within a timerange?
Changed in activity-log-manager:
status: New → Invalid
Changed in zeitgeist:
importance: Undecided → Wishlist
Revision history for this message
Seif Lotfy (seif) wrote :

Siegfried I like the idea of deleting events within a timeframe
maybe a the same arguments like find_events but that actually deletes the found events

Revision history for this message
Seif Lotfy (seif) wrote :

so something like

delete_events_for_template (TimeRange tr, event_templates)

also expose it over dbus and add some tests

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

How about doing it in 2 steps

find_events_ids
THEN
then delete_events

Revision history for this message
Trever Fischer (tdfischer) wrote :

A potential solution?

Revision history for this message
Seif Lotfy (seif) wrote : Re: [Bug 799531] Re: API for deletion of events within a timerange?

looks good
can you make it return the ids of the events that got deleted?
It should support a callback

2012/3/12 Trever Fischer <email address hidden>

> A potential solution?
>
> ** Patch added: "bzr.patch"
>
> https://bugs.launchpad.net/zeitgeist/+bug/799531/+attachment/2857018/+files/bzr.patch
>
> --
> You received this bug notification because you are a member of Activity
> Log Manager, which is the registrant for Activity Log Manager.
> https://bugs.launchpad.net/bugs/799531
>
> Title:
> API for deletion of events within a timerange?
>
> Status in Activity Log Manager for Zeitgeist:
> Invalid
> Status in Zeitgeist Framework:
> New
>
> Bug description:
> If I try to select date range more then a month it just freezes.
>
> $ activity-log-manager
> INFO:zeitgeist.client:Reconnected to Zeitgeist engine...
> Error from Zeitgeist engine:
> org.freedesktop.DBus.Python.sqlite3.OperationalError: Traceback (most
> recent call last):
> File "/usr/lib/pymodules/python2.7/dbus/service.py", line 702, in
> _message_cb
> retval = candidate_method(self, *args, **keywords)
> File "/usr/share/zeitgeist/_zeitgeist/engine/remote.py", line 337, in
> DeleteEvents
> timestamps = self._engine.delete_events(event_ids, sender=sender)
> File "/usr/share/zeitgeist/_zeitgeist/engine/main.py", line 838, in
> delete_events
> % ",".join(["?"] * len(ids)), ids)
> File "/usr/share/zeitgeist/_zeitgeist/engine/sql.py", line 74, in
> execute
> return super(UnicodeCursor, self).execute(statement, parameters)
> OperationalError: too many SQL variables
>
> Version: 0.8.0-0ubuntu1~ppa2~natty
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/activity-log-manager/+bug/799531/+subscriptions
>

Seif Lotfy (seif)
Changed in zeitgeist:
status: New → Triaged
assignee: nobody → Trever Fischer (tdfischer)
Seif Lotfy (seif)
Changed in zeitgeist:
status: Triaged → In Progress
Changed in zeitgeist:
status: In Progress → Fix Committed
Changed in zeitgeist:
status: Fix Committed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.