Support fetch all keys and data
This commit is contained in:
@@ -64,14 +64,6 @@ def get_scada_element_schema(name: str) -> dict[str, dict[str, Any]]:
|
||||
'status' : {'type': 'str' , 'optional': True , 'readonly': False} }
|
||||
|
||||
|
||||
def get_scada_elements(name: str) -> list[str]:
|
||||
result : list[str] = []
|
||||
rows = read_all(name, 'select id from scada_element order by id')
|
||||
for row in rows:
|
||||
result.append(str(row['id']))
|
||||
return result
|
||||
|
||||
|
||||
def get_scada_element(name: str, id: str) -> dict[str, Any]:
|
||||
sm = try_read(name, f"select * from scada_element where id = '{id}'")
|
||||
if sm == None:
|
||||
@@ -178,3 +170,14 @@ def delete_scada_element(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
if get_scada_element(name, cs.operations[0]['id']) == {}:
|
||||
return ChangeSet()
|
||||
return execute_command(name, _delete_scada_element(name, cs))
|
||||
|
||||
|
||||
def get_all_scada_element_ids(name: str) -> list[str]:
|
||||
result : list[str] = []
|
||||
rows = read_all(name, 'select id from scada_element order by id')
|
||||
for row in rows:
|
||||
result.append(str(row['id']))
|
||||
return result
|
||||
|
||||
def get_all_scada_elements(name: str) -> list[dict[str, Any]]:
|
||||
return read_all(name, 'select * from scada_element order by id')
|
||||
|
||||
Reference in New Issue
Block a user