Hi, Maybe some better explanation is required from my side for you to be able to help me better.
My app is basically for doing some plotting, analysis and filtering of securities on the stock market. The main class that does most of the work is Security(HasTraitsORM), where HasTraitsORM is my version of declarative's Base class which takes care of turning traits (attributes) into correctly typed Columns for declarative to set up the mapping. The Security class also handles retrieving historical data from an hdf5 file which in my opinion is better suited to storing such data in an hierarchical structure (with added transparent compression). SQLAlchemy comes into the picture for running queries mostly. And storing precomputed values. For instance, using the above setup, I can add a child class SMAFields at runtime which computes some simple moving averages of closing prices. Once computed this gets stored in its own table with columns sma10, sma20, sma50, etc. for the different periods. Using a combination of traits and SA any Security instance then has some new attributes, sec.sma10 for instance. Which is either retrieved from the SMAFields table via SA or computed from methods on the SMAFields class if needed. Though the really useful bit is querying: sess.query(Security).filter(Security.sma10 <= Security.sma20), which behaves as one would expect. The idea being that the user can easily add new functions for computing values from a security's data, and after the new table is created and filled with the results, he can run normal sql queries on it. Any other child classes that get added also have access to the SMAFields class's fields through it's Security relation. Thus a user can add as many child classes with as many columns as they want, and have access to all the fields they've already set up. I'm not sure something like that is possible through inheritance? The new fields can then be added to the table viewer in the gui and basically be used as if they were part of the Security class from the beginning, running sql queries being the most important feature. It mostly works, though the really ugly hacking of SA I've done to get it to work might not be perfect. Is there a more elegant way to this? Is this even the best approach at allowing a user to add new behaviour to the application? I'm new to SA and have never used any SQL before either so I'm sure there must be better design patterns for something like this already. I hope it's clear what my intent is now. Thanks again for you help svilen. Regards, Christian --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---