classes and sub classes?

Morten Guldager morten.guldager at gmail.com
Tue Apr 9 01:50:11 EDT 2013


'Aloha Friends!

I'm about to write an API against a huge propitiatory Oracle based network
inventory database. The database have many different concepts stored in
it's tables, can one concept can span over multiple tables.

I would like to write a class for accessing each concept, but only have a
single database connection throughout the whole program.

I imagine some code along these lines, but cant figure out how to declare
the classes that will make it work:

# create a connection to the database and perform come basic login and
initialization
nib = NwInvDb("scott/tiger at ora")
# find a device by ip
interesting_device = nib.Device.lookup_by_ip("192.168.1.1")

In this example I access the concept Device.

Should I make the Device class inherit from NwInvDb? Or should I keep them
separate? Later on I think I will even have to make some sort of
sub-concepts, but lets postpone that game until I really have really seen
the need!


-- 
/Morten %-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130409/395c1e30/attachment.html>


More information about the Python-list mailing list