MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / new_historized_node

Method new_historized_node

opcua/server/history_sql.py:31–53  ·  view source on GitHub ↗
(self, node_id, period, count=0)

Source from the content-addressed store, hash-verified

29 self._conn = sqlite3.connect(self._db_file, detect_types=sqlite3.PARSE_DECLTYPES, check_same_thread=False)
30
31 def new_historized_node(self, node_id, period, count=0):
32 with self._lock:
33 _c_new = self._conn.cursor()
34
35 table = self._get_table_name(node_id)
36
37 self._datachanges_period[node_id] = period, count
38
39 # create a table for the node which will store attributes of the DataValue object
40 # note: Value/VariantType TEXT is only for human reading, the actual data is stored in VariantBinary column
41 try:
42 _c_new.execute('CREATE TABLE "{tn}" (_Id INTEGER PRIMARY KEY NOT NULL,'
43 ' ServerTimestamp TIMESTAMP,'
44 ' SourceTimestamp TIMESTAMP,'
45 ' StatusCode INTEGER,'
46 ' Value TEXT,'
47 ' VariantType TEXT,'
48 ' VariantBinary BLOB)'.format(tn=table))
49
50 except sqlite3.Error as e:
51 self.logger.info('Historizing SQL Table Creation Error for %s: %s', node_id, e)
52
53 self._conn.commit()
54
55 def save_node_value(self, node_id, datavalue):
56 with self._lock:

Callers

nothing calls this directly

Calls 1

_get_table_nameMethod · 0.95

Tested by

no test coverage detected