[ovs-dev] [python idl 16/16] python: Implement write support in Python IDL for OVSDB.

Ben Pfaff blp at nicira.com
Wed Sep 21 19:42:14 UTC 2011


On Wed, Sep 21, 2011 at 12:35:15PM -0700, Ethan Jackson wrote:
> > I'd view calling it directly as a layering violation. ?A Datum doesn't
> > currently know anything about the IDL. ?Making it know directly about
> > ovs.db.idl.Row and what to do about it seems like a bad idea.
> >
> > If you'd prefer, I'll move to_python() into the Idl code as an
> > internal helper, in which case no uuid_to_row argument is needed.
> > That's the way I had it originally, but then I thought that it was
> > more naturally a method on Datum.
> 
> I don't have a preference in particular I suppose.  Most users won't
> be directly calling to_python() directly will they?  If it's mostly
> used internally in the idl I think it doesn't matter.

I don't expect other users.

> > The caller is allowed to add attributes to schema columns (in
> > particular, 'alert') that ovs.db.schema.DbSchema won't copy.
> 
> Ah, I didn't realize that couldn't happen after the constructor was
> called.  Seems fine then.

It's probably not a wonderful idea, but it works really well.

> > ? ?string_type = types.Type.from_json("string")
> > ? ?string_map_type = types.Type.from_json(["key": "string",
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"value": "string",
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"min": 0,
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"max": "unlimited"])
> >
> > Or we could just not bother with validating the types anymore, since
> > they're part of the distribution instead of retrieved remotely from
> > the database now.
> 
> I think using from_json as described above is a readable way to do it.
>  I don't really have an opinion on whether or not we should be
> validating the types in the first place.  If you think there is a
> value in it then we should probably leave it.

I think I'll leave it, for now.  I'm open to deleting it later; it's
not critical by any means.

I think this series is fully reviewed now.  I'll test it and push it.



More information about the dev mailing list