On Jan 1, 5:18 pm, "sudhakar m" <[email protected]> wrote:
> In Gae, we can specify the choices when creating the stringproperty.
>
> * phone_type = db.StringProperty(
> choices=('home', 'work', 'fax', 'mobile', 'other'))
> *
>
> This will prevent other value's to this field. I am finding it very much
> useful for my current design.
> But how do i represent this in web2py's model. Is there any helper available
> for same.
>
> I am perfectly ok with using gae api (portability is not an issue).
I wound up switching to that when I started running into pretty much
the same issues you are.
Like several others have pointed out in this thread, there are
workarounds. But google's datastore is so slow, and their limits so
tight that it just seemed silly to add any extra overhead. BigTable
is *not* an RDBMS. Trying to shoehorn it into acting like one doesn't
make a lot of sense. You lose its advantages, and you just get
something that looks vaguely like a crippled RDBMS.
It might count as premature optimization, but you should be able to
tell pretty quickly. Set up the models with the suggested work-
arounds. Bulk upload a few thousand records. Set up a page or three
that run the most complicated queries you expect to see. Then check
your logs.
If you have warnings about CPU quota, request time, or actually get
time-outs, these suggestions will not work for you.
Based just on what I've seen on the GAE mailing list, I think you'll
need to make the same switch I did.
> But I am
> bit struck up finding the right place to define this(model/controller).
I started out with a GaeModels.py in my app's modules folder. I
defined my models (just using the GAE API) there. Then I added a
helper class and only access my models through it. That way, if I do
have to switch later, I only have to update those 2 things.
[Later, after I'd trimmed down my web2py installation immensely, so I
wasn't as worried about the file count limit, I switched that to a
GaeModels folder with an __init__.py that imports all my models and
then broke each model into its own class. I'm mentioning this only
because you said you're new to python, so I'm guessing you haven't
seen this trick yet].
If you're totally not worried about portability, just define them in
your models folder.
> Also how do i use it with SQLFORM?. How well does it play with rest of web2py
> code.
I don't think I've ever used SQLFORM. I'm perfectly fine with
building my own forms, saving my own data, and doing my own
validation. Actually, at this point, most of my interaction is
switching to using dojo with Ajax and json. I may be missing one of
those basic pieces of web2py that would make my life *much* easier,
but I'm okay with that.
It would be interesting to see what it would take to make SQLFORM work
directly with google's datastore models.
> I also came across the following
> thread,http://groups.google.com/group/web2py/browse_thread/thread/13f3fb91f9...
>
> where creating new types like 'list_of_intgers', 'list_of_floats',
> 'list_of_stings' are discussed. But couldnt find further information on Gae
> specific datatypes (particularly
> ListProperty<http://code.google.com/appengine/docs/datastore/typesandpropertyclass...>
> )
>
> Anybody using these gae data types in web2py. Can somebody share some
> thoughts on this?
>
> Sorry if i am missing something obvious here.
I think you see the situation pretty clearly.
> Sudhakar.M
> A mind once stretched by a new idea never regains its original dimension. -
> Oliver Wendell Holmes
Regards,
James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---