how to use GAE specific model properties?

8 views
Skip to first unread message

Robin B

unread,
Jun 19, 2008, 1:34:48 PM6/19/08
to web2py Web Framework
GAE supports some non-sql datatypes like StringListProperty (which is
needed for search). Is there any mechanism to use these extended
properties knowing that they will not be sql compatible?

Thanks,

Robin

yarko

unread,
Jun 19, 2008, 3:15:20 PM6/19/08
to web2py Web Framework
I think I've seen Massimo suggest to just use GAE APIs for this sort
of thing,
but perhaps more interestingly would be:

Why do you want to use this? (Search)
What about Google Search Interface could be abstracted for a generic
web2py search I/F?
(And who would write the portable appliance to implement search)?

CALL FOR DISCUSSION / INPUT

Massimo Di Pierro

unread,
Jun 19, 2008, 3:31:26 PM6/19/08
to web...@googlegroups.com
Good question. For now no. Anyway, the answer would become yes if we
can implement in a portable way that works without GAE as well.

Robin B

unread,
Jun 19, 2008, 3:52:46 PM6/19/08
to web2py Web Framework
GQL resembles SQL, but the underlying DB is non-relational and
distributed, so to fully utilize GAE, web2py could wrap the GAE API,
yet allow developers easy access non-compatible features in a
consistent and safe way.

Assign the parent on a GAE entity to set an existing entity group.
(could be ignored in SQL)
Use ListProperty, StringListProperty as property types.

Maybe an extensible model meta data could be used:

db.define_table("posts",

SQLField("title","string",ext=dict(type='StringListProperty'),meta=dict(form_type='text_field'))
)

db.posts.gae_entity_parent_field = 'entity_parent'

mdipierro

unread,
Jun 19, 2008, 10:22:36 PM6/19/08
to web2py Web Framework
Something like this should be easy to implement. although I would just
create new types like 'list_of_intgers', 'list_of_floats',
'list_of_stings'. Am I missing any combination. Would you send me a
patch?

Robin B

unread,
Jun 19, 2008, 11:38:39 PM6/19/08
to web2py Web Framework
Could you clarify how the interface should look?

SQLField("title","list_of_stings")

and SQL will treat it like a "string", and GQL will treat it like a
"StringListProperty"

or add model meta data?

What about creating a field to set the parent key?

Massimo Di Pierro

unread,
Jun 19, 2008, 11:50:41 PM6/19/08
to web...@googlegroups.com

On Jun 19, 2008, at 10:38 PM, Robin B wrote:

>
> Could you clarify how the interface should look?
>
> SQLField("title","list_of_stings")
>
> and SQL will treat it like a "string", and GQL will treat it like a
> "StringListProperty"


yes for GQL. Not sure we should support this to SQL too This is very
specific of GQL. The physlosophy behind sql.py is make the tines
possible abstraction layer on SQL. Implementing things that are
typical GAE wierdness will result in bloated code that may be
inefficient and should not be encouraged.

> or add model meta data?

I do not think we need meta data.

> What about creating a field to set the parent key?

Why? Not sure I understand the question.

Massimo Di Pierro

unread,
Jun 20, 2008, 12:04:10 AM6/20/08
to web...@googlegroups.com
I think it will be easy and better to implement SQL operators LIKE,
IN, OR on GAE rather the opposite. Here is how...

1)

WHERE firstname='Max' and (lastname='DiPierro' OR lastname LIKE 'Di%')

is equivalent to

WHERE (firstname='Max' AND astname='DiPierro') OR (firstname='Max'
AND lastname LIKE 'Di%')

2) execute
SET1 = SELECT * from .... WHERE (firstname='Max' AND
lastname='DiPierro') on GAE and
SET2 = SELECT * from .... WHERE (firstname='Max') on GAE seperately

3) Filter SET2 by lastname LIKE 'Di%' and merge SET1 with SET2

4) resort and regroup using python the merged set of records

This is not that difficult to do and is very general.

On Jun 19, 2008, at 10:38 PM, Robin B wrote:

Reply all
Reply to author
Forward
0 new messages