We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 93010e1 commit f0980a0Copy full SHA for f0980a0
src/swsssdk/configdb.py
@@ -238,6 +238,18 @@ def get_table(self, table):
238
pass #Ignore non table-formated redis entries
239
return data
240
241
+ def delete_table(self, table):
242
+ """Delete an entire table from config db.
243
+ Args:
244
+ table: Table name.
245
+ """
246
+ client = self.redis_clients[self.CONFIG_DB]
247
+ pattern = '{}{}*'.format(table.upper(), self.TABLE_NAME_SEPARATOR)
248
+ keys = client.keys(pattern)
249
+ data = {}
250
+ for key in keys:
251
+ client.delete(key)
252
+
253
def mod_config(self, data):
254
"""Write multiple tables into config db.
255
Extra entries/fields in the db which are not in the data are kept.
0 commit comments