Skip to content

Commit

Permalink
Update history_sql.py
Browse files Browse the repository at this point in the history
recreated after branch deleted: because of #286
  • Loading branch information
AndreasHeine authored and oroulet committed Sep 18, 2020
1 parent c9c998f commit dba4efe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions asyncua/server/history_sql.py
Expand Up @@ -133,7 +133,7 @@ async def new_historized_event(self, source_id, evtypes, period, count=0):
self.logger.info("Historizing SQL Table Creation Error for events from %s: %s", source_id, e)

async def save_event(self, event):
table = self._get_table_name(event.emitting_node)
table = self._get_table_name(event.SourceNode)
columns, placeholders, evtup = self._format_event(event)
event_type = event.EventType # useful for troubleshooting database
# insert the event into the database
Expand All @@ -145,7 +145,7 @@ async def save_event(self, event):
)
await self._db.commit()
except aiosqlite.Error as e:
self.logger.error("Historizing SQL Insert Error for events from %s: %s", event.emitting_node, e)
self.logger.error("Historizing SQL Insert Error for events from %s: %s", event.SourceNode, e)
# get this node's period from the period dict and calculate the limit
period = self._datachanges_period[event.emitting_node]
if period:
Expand All @@ -155,7 +155,7 @@ async def save_event(self, event):
await self._db.execute(f'DELETE FROM "{table}" WHERE Time < ?', (date_limit.isoformat(' '),))
await self._db.commit()
except aiosqlite.Error as e:
self.logger.error(f"Historizing SQL Delete Old Data Error for events from {event.emitting_node}: {e}")
self.logger.error(f"Historizing SQL Delete Old Data Error for events from {event.SourceNode}: {e}")

async def read_event_history(self, source_id, start, end, nb_values, evfilter):
table = self._get_table_name(source_id)
Expand Down

0 comments on commit dba4efe

Please sign in to comment.