Have you looked at the class db.Expando. That has the ability to
create dynamic properties.
But it sounds like you want to have runtime determined kinds. In
this case, expando is not what you need. Take a look at
datastore.Entity, which is what underlies the Model classes, as it has
the precise interface you are indicating below.
Please be warned, however, that the Entity class is not documented
and you may not be able to get support for it. I might be able to
answer a couple of questions if that's the route you would like to
choose, but it's not officially supported.
On Sep 26, 4:19 pm, koblas <[EMAIL PROTECTED]> wrote:
> I'm not going to make any claims to being a python expert, nor is this
> a trivial question.
>
> What I want to do is have the ability to have an abstract interface
> for table contruction -- think UI where you can say "add field ...
> type String". Once you've specified the database table format from
> the UI, would like to take advatange of the non-tightly structured
> database underlying App Engine.
>
> What I would like to have is a class like:
> GenericTable(db.Model)
> ....
> def __init__(self, tbl) :
> ...
> def __getattr__(self, name) :
> ....for purposes of example...
>
> So in my view code I can say:
> tbl = GenericTable("books")
> items = tbl.all()
> for item in items :
> ...something interesting...
> ...with the ability to say item['price'] -- via the above
> __getattr__
>
> Hopefully this gives you a good idea of intent, where things are
> getting muddled up is I'm not sure if it's better to extend db.Model /
> db.PropertiedClass or build something totally new from the ground
> up...
>
> Anybody tried this before, or maybe has some good pointers on what is
> a "better" course of action?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---