[sqlalchemy] SA and IBM DB2

2011-06-29 Thread Luca Lesinigo
Hello there. I'd like to use SQLalchemy with an existing db2 database
(I can already access it with plain SQL using pyODBC from a python-2.6/
win32 system).

Googling around, I found http://code.google.com/p/ibm-db and it seems
to have an updated DB-API driver for python-2.6/win32, but the latest
SA adapter is for sqlalchemy-0.4.

Is there any way to access DB2 from sqlalchemy-0.6 or -0.7?
If that helps, I'm gonna use it in read-only (ie, no INSERT, UPDATE,
DELETE queries will be issued nor would they be accepted by the db)

thanks, Luca

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



[sqlalchemy] Avoiding spaghetti inheritance

2011-04-07 Thread Luca Lesinigo
Hello there. I'm using SA-0.7 to develop an application that should
help me manage my company's services.

A central concept here is the order, it could be a service (like one
year of web hosting) or a physical item (like a pc we sell). So far I
generalized them in two classes: the Order and the ServiceOrder - the
latter simply inherits the former and adds start and end dates.

Now I need to add all various kinds of metadata to orders, for
example:
- a ServiceOrder for a domain hosting should contain the domain name
- a ServiceOrder for a maintenance service should contain the service
level for that service (say, basic or advanced)
- an Order for a PC we delivered should contain its serial number
- and so on...

I could easily add child classes, but that would mean to keep and
maintain that code forever even after we stop using it (ie, next year
we stop doing hosting) or when it's not really useful (many things
will just have some 'metadata' in them like a serial number or similar
things). I'd also like to avoid having to add code every time we just
hit something slightly different to manage, when we just have some
additional data to keep track of.
I wonder what could be an intelligent approach to such a situation.

One idea I got could be to add an 'OrderTags' table / class that would
associate (tag, value) tuples to my orders, and somehow access them
like a dictionary (eg. Order.tags['serialnumber'] = 'foo' or
ServiceOrder.tags['domainname'] = 'example.com'). But that will
probably keep them out of standard SA queries? For example, if I want
to retrieve the full history of a domain we're hosting, how could I
query for all orders with (tags['domainname'] == something)?

I'm looking for advice on how to structure this data, and how to best
implement it with python and sqlalchemy-0.7.

Thank you,
Luca

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.