Convert an event object triggered by the subscription into ordered lists for the SQL insert string Args: event: The event returned by the subscription Returns: List of event fields (SQL column names), List of '?' placeholders, Tuple of variant binaries
(self, event)
| 282 | return start_time, end_time, order, limit |
| 283 | |
| 284 | def _format_event(self, event): |
| 285 | """ |
| 286 | Convert an event object triggered by the subscription into ordered lists for the SQL insert string |
| 287 | |
| 288 | Args: |
| 289 | event: The event returned by the subscription |
| 290 | |
| 291 | Returns: List of event fields (SQL column names), List of '?' placeholders, Tuple of variant binaries |
| 292 | |
| 293 | """ |
| 294 | placeholders = [] |
| 295 | ev_variant_binaries = [] |
| 296 | |
| 297 | ev_variant_dict = event.get_event_props_as_fields_dict() |
| 298 | names = list(ev_variant_dict.keys()) |
| 299 | names.sort() # sort alphabetically since dict is not sorted |
| 300 | |
| 301 | # split dict into two synchronized lists which will be converted to SQL strings |
| 302 | # note that the variants are converted to binary objects for storing in SQL BLOB format |
| 303 | for name in names: |
| 304 | variant = ev_variant_dict[name] |
| 305 | placeholders.append('?') |
| 306 | ev_variant_binaries.append(sqlite3.Binary(variant_to_binary(variant))) |
| 307 | |
| 308 | return self._list_to_sql_str(names), self._list_to_sql_str(placeholders, False), tuple(ev_variant_binaries) |
| 309 | |
| 310 | def _get_event_columns(self, ev_fields): |
| 311 | fields = [] |
no test coverage detected