(self, source_id, evtypes, period, count=0)
| 134 | return results, cont |
| 135 | |
| 136 | def new_historized_event(self, source_id, evtypes, period, count=0): |
| 137 | with self._lock: |
| 138 | _c_new = self._conn.cursor() |
| 139 | |
| 140 | # get all fields for the event type nodes |
| 141 | ev_fields = self._get_event_fields(evtypes) |
| 142 | |
| 143 | self._datachanges_period[source_id] = period |
| 144 | self._event_fields[source_id] = ev_fields |
| 145 | |
| 146 | table = self._get_table_name(source_id) |
| 147 | columns = self._get_event_columns(ev_fields) |
| 148 | |
| 149 | # create a table for the event which will store fields generated by the source object's events |
| 150 | # note that _Timestamp is for SQL query, _EventTypeName is for debugging, be careful not to create event |
| 151 | # properties with these names |
| 152 | try: |
| 153 | _c_new.execute( |
| 154 | 'CREATE TABLE "{tn}" (_Id INTEGER PRIMARY KEY NOT NULL, _Timestamp TIMESTAMP, _EventTypeName TEXT, {co})' |
| 155 | .format(tn=table, co=columns)) |
| 156 | |
| 157 | except sqlite3.Error as e: |
| 158 | self.logger.info('Historizing SQL Table Creation Error for events from %s: %s', source_id, e) |
| 159 | |
| 160 | self._conn.commit() |
| 161 | |
| 162 | def save_event(self, event): |
| 163 | with self._lock: |
nothing calls this directly
no test coverage detected