db.Field or SQLField??

0 views
Skip to first unread message

Italo Maia

unread,
Apr 15, 2009, 11:37:48 PM4/15/09
to web2py Web Framework
Just saw a video (http://www.vimeo.com/2720410) where db.Field was
user, and not SQLField...Which should be used?

mdipierro

unread,
Apr 16, 2009, 12:54:16 AM4/16/09
to web2py Web Framework
db.Field() because it avoid conflicts when running on Google App
Engine.

desfrenes

unread,
Apr 16, 2009, 6:12:38 AM4/16/09
to web2py Web Framework
I'm not sure to understand what that means... you mean SQLField should
be used in relational databases and Field in non-relational
databases ?

mdipierro

unread,
Apr 16, 2009, 9:03:05 AM4/16/09
to web2py Web Framework
I am saying they are equivalent since db.Field == SQLField.

Some times, if you use GAE, SQLField can be ambiguous (because there
are two of them one in gluon.sql and one in gluon.contrib.gql).
db.Field always refer to the correct one and avoids the ambiguity.

I would suggest always using db.Field but this is not a big deal.

Massimo

desfrenes

unread,
Apr 16, 2009, 9:07:36 AM4/16/09
to web2py Web Framework
ok, this is clear now :-)

Italo Maia

unread,
Apr 16, 2009, 6:00:44 PM4/16/09
to web2py Web Framework
shouldn't SQLField be removed, then?

Italo Maia

unread,
Apr 16, 2009, 6:01:12 PM4/16/09
to web2py Web Framework
The shortcut, i mean.

On 16 abr, 10:07, desfrenes <desfre...@gmail.com> wrote:

Iceberg

unread,
Apr 16, 2009, 10:06:28 PM4/16/09
to web2py Web Framework
I guess the answer is NO, because we need backward compatibility.
However, I would suggest to add the description about SQLField VS
db.Field in DAL document (http://www.web2py.com/examples/default/dal),
so old users do get confused when seeing db.Field at the first time. I
bet few people know the difference between SQLField and db.Field
before this discussing thread. I didn't know that too.

mdipierro

unread,
Apr 16, 2009, 10:27:35 PM4/16/09
to web2py Web Framework
There is also the issue of form_factory. You have no DB there and must
use SQLField.

Massimo

Yannick

unread,
Apr 21, 2009, 9:45:11 PM4/21/09
to web2py Web Framework
Good to know... Those can be good subject in the new version of the
book since it can be confusing for new user... I didn't know that b4.

Thanks for the thread,
Yannick P.
Reply all
Reply to author
Forward
0 new messages