[ovs-discuss] ovsdb python library .. accessing row elements using a variable as the key

Mir Ali mir_ali at outlook.com
Thu Jul 9 10:19:55 UTC 2015


Hi,
How can I access a particular column from the row if the column attribute is a variable.

For example, in a Bridge table I can access the name of the bridge using 'row.name'. I want to do the same but using the column name as a variable. If I can do something as row['name'] it will help me a lot. So far all the methods I tried failed.

row._data['name'] doesn't work either.

My code is as follows:

txn = ovs.db.idl.Transaction(idl)
bridge_table = idl.tables['Bridge']
column_keys = bridge_table.columns.keys()
row = txn.insert(bridge_table)

for key in column_keys:
   # how can I assign row elements using the variable 'key'
    row['key'] = some_default_value # This doesn't work.

Any help will be great.

Thanks
Mir

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20150709/e6150fef/attachment-0002.html>


More information about the discuss mailing list