- all_fields = EventObject.fields.keys()
- if not columns:
- columns = all_fields
- else:
- columns = filter(lambda column: column in all_fields, columns)
-
- # Since we are querying a table (not a view) ensure that timestamps
- # are converted to ints in the db before being returned
- timestamps = ['time']
- for col in columns:
- if col in timestamps:
- index = columns.index(col)
- columns[index] = "CAST(date_part('epoch', events.time) AS bigint) AS time"
- elif col in [EventObject.primary_key]:
- index = columns.index(col)
- columns[index] = EventObject.table_name+"."+EventObject.primary_key
-
- sql = "SELECT %s FROM event_object, events WHERE True" % \
- ", ".join(columns)
+ sql = "SELECT %s FROM view_event_objects WHERE True" % \
+ ", ".join(self.columns)