Re: Eve from Adams' Ribs
Godwin wrote: But the funny fact is that i want this class to be dynamically generated at run time simply from a table name string. The thing you are looking for is called an object-relational mapper. try SQLObject http://sqlobject.org/ This is mainly intended to work the other way (i.e. describe the structure in Python and create tables from that), but it does support a get the structure from a legacy table mode that may be good enough (you may be in strife if your existing tables don't meet certain requirements, like having a unique integer key, or have odd column-naming schema etc). I don't think it supports Oracle (yet...) -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
ORM: Several to choose from: http://blogs.nuxeo.com/sections/blogs/florent_guillaume/2005_08_11_object_relational http://en.wikipedia.org/wiki/Object-relational_mapping#Python http://www.python.org/pypi?:action=browseasdf=256 -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
Godwin wrote: I think its possible with python as it is called a dynamic language. Certainly, but what's really the point with these classes? If they are completely generated from tables, they won't have different behaviour anyway, just a different chunk of attributes to fetch, save and update. It's probably as easy to just have one class, and to have a dynamic list of attributes and values that you define by passing in the table name in __init__. -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
www.devx.com/dbzone/Article/22093 U've made a point and i have seen that approach in the above article. But i was curious about creating python classes and code on fly. The only way i could do it was by using exec function. Is there a standard way of doing it. What are the plus points of such kind of programming? Is it only done by hackers? Sorry for asking the wrong question for getting the right answer! -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
Thanx for the links , i loved the monty lingua module u gave me before. -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
yes i did hear about sqlobject but as u said it doesn't support oracle yet. Thanx -- http://mail.python.org/mailman/listinfo/python-list