Other new DAL features in trunk

31 views
Skip to first unread message

mdipierro

unread,
Nov 9, 2009, 10:54:12 AM11/9/09
to web2py-users
Thanks to Michael Fig we have two new important features in trunk

1) to deal with legacy databases

db.define_table('mytable',Field('myfield','id'),Field
('otherfield'))

allows to redefine the name of the 'id' field.

2) If you mess up .table files you ca try:

delete all .table files
db.define_table(....,make_migrate=True)

The latter will rebuild missing .table files. Only works if table
defintions and db tables are consistent.

Let me know if test any of this.

Massimo

Iceberg

unread,
Nov 10, 2009, 12:07:40 AM11/10/09
to web2py-users
Off topic.

Recently web2py evolutes with many great enhancement. That is, without
doubt, a good thing. Yet it will be better if the new features are
documented, even roughly mentioned, in some well-known place. So that
people who missed a post in google mail list (and google-maillist-
search sucks) still have a chance to catch up later.

For example, the two features in this post should better be mentioned
in http://www.web2py.com/examples/default/dal

mdipierro

unread,
Nov 10, 2009, 1:59:41 AM11/10/09
to web2py-users
I will update the documentation as soon as possible. If you can send
me a patch it will happen sooner.

On Nov 9, 11:07 pm, Iceberg <iceb...@21cn.com> wrote:
> Off topic.
>
> Recently web2py evolutes with many great enhancement. That is, without
> doubt, a good thing. Yet it will be better if the new features are
> documented, even roughly mentioned, in some well-known place. So that
> people who missed a post in google mail list (and google-maillist-
> search sucks) still have a chance to catch up later.
>
> For example, the two features in this post should better be mentioned
> inhttp://www.web2py.com/examples/default/dal

Tim Michelsen

unread,
Nov 10, 2009, 6:50:50 PM11/10/09
to web...@googlegroups.com
> 1) to deal with legacy databases
>
> db.define_table('mytable',Field('myfield','id'),Field
> ('otherfield'))
does legacy database id settings also support SQLite tables?

mdipierro

unread,
Nov 10, 2009, 7:07:05 PM11/10/09
to web2py-users
yes but the 'id' has to be integer

chris_g

unread,
Nov 11, 2009, 1:29:50 AM11/11/09
to web2py-users
This is marvellous news. I read the manual last night and realised
that the field ID restriction was the only thing stopping me deploying
web2py in conjunction with a major legacy app that I am using.
Thanks Michael for getting this feature happening.

Can I confirm one thing, with a table like this:

create table store (
ID int,
StoreID int,
Name varchar(60)
)

where I want to use StoreID as the 'id' field, but there happens to be
an existing field called 'ID'.
I have this situation because due to some historical replication
issues.

Chris Guest

Reply all
Reply to author
Forward
0 new messages