From 7698e31d6a3467948224f056183427f4b8f2d4d9 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Thu, 13 Sep 2012 11:22:53 +0900 Subject: [PATCH] python/ovs/db/idl: add counterpart of ovsdb_idl_add_table() Add register_table method to SchemaHelper as Python counterpart of ovsdb_idl_add_table() in the C version of the IDL. Signed-off-by: Isaku Yamahata Signed-off-by: Ben Pfaff --- python/ovs/db/idl.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py index e4b98e8b..5b06d910 100644 --- a/python/ovs/db/idl.py +++ b/python/ovs/db/idl.py @@ -1224,6 +1224,15 @@ class SchemaHelper(object): columns = set(columns) | self._tables.get(table, set()) self._tables[table] = columns + def register_table(self, table): + """Registers interest in the given all columns of 'table'. Future calls + to get_idl_schema() will include all columns of 'table'. + + 'table' must be a string + """ + assert type(table) is str + self._tables[table] = set() # empty set means all columns in the table + def register_all(self): """Registers interest in every column of every table.""" self._all = True @@ -1249,6 +1258,10 @@ class SchemaHelper(object): assert table_name in schema.tables table = schema.tables[table_name] + if not columns: + # empty set means all columns in the table + return table + new_columns = {} for column_name in columns: assert type(column_name) is str -- 2.30.2