Update events.py

Made modifications for sqlite capable queries.