query any of the slices at their sites. Admins and nodes may query
any slice. If a slice that cannot be queried is specified in
slice_filter, details about that slice will not be returned.
+
+ In addition to the usual filter mechanism, when using a dictionary as filter,
+ it is possible to add the 'ALL' key - its value being then ignored -
+ that will return all slices even the ones that have been deleted
+ because they have expired.
"""
roles = ['admin', 'pi', 'user', 'node']
view = f"{view} left join {table} using ({Slice.primary_key})"
selected = ", ".join(list(self.columns.keys())+list(self.tag_columns.keys()))
- sql = f"SELECT {selected} FROM {view} WHERE is_deleted IS False"
+ sql = f"SELECT {selected} FROM {view} WHERE TRUE"
+ remove_deleted = True
if expires is not None:
if expires >= 0:
slice_filter = Filter(Slice.fields, {'slice_id': ints, 'name': strs})
sql += " AND (%s) %s" % slice_filter.sql(api, "OR")
elif isinstance(slice_filter, dict):
+ if 'ALL' in slice_filter:
+ remove_deleted = False
+ del slice_filter['ALL']
allowed_fields = dict(list(Slice.fields.items())+list(Slice.tags.items()))
slice_filter = Filter(allowed_fields, slice_filter)
sql += " AND (%s) %s" % slice_filter.sql(api, "AND")
else:
raise PLCInvalidArgument(f"Wrong slice filter {slice_filter!r}")
+ if remove_deleted:
+ sql += " AND is_deleted IS False"
+
self.selectall(sql)