[PonyORM-list] Creating Dynamic Classes in Pony (need help)

Ivan Evstegneev webmailgroups at gmail.com
Sun Mar 15 20:13:13 UTC 2015


Hello,

First of all, I'm absolutely new to DBs and relatively new to Python )))). 

But got my work to do (EE student  project). So please don't blame me for
incorrect terminology. 

My question is simple (at least it seems so to me ^_^):

Is it possible to create a dynamic classes with pony_orm? 

Something similar to this: 

http://stackoverflow.com/questions/2827623/python-create-object-and-add-attr
ibutes-to-it

or this:

http://code.activestate.com/recipes/52308-the-simple-but-handy-collector-of-
a-bunch-of-named/?in=user-97991


By "dynamic" I mean that class attributes are not static.

For instance, let's say I have some "node.xls" file which contains some
table as this one:

                                param1    param2........ parmaN

element1              value 1    value2...........valueN
element2              value 1    value2...........valueN
.
.

element              value 1    value2...........valueN

So I might define a class in pony_orm  which will be called as Node() and
would include all those (param1 to paramN) and then just assign their
values.

But this is a static way. What happens when I'll ( at some time) add
param(N+1) into my "node.xls"? So in such case I would need to redefine
Node() class. 
Sounds not so hard task to do... But if there some more "xls" files  and
more params will be added over time to each one of them...
I would definitely get into trouble, by spending all my free time to
actually make it up-to-date.


Hope my question clear enough.

Any provided help(ideas, code snippets of possible realization, links  etc.)
will be highly appreciated.

Thanks a lot in advance,

Ivan.




More information about the ponyorm-list mailing list