crud and dbsprockets problem on tg2

3 views
Skip to first unread message

dakila

unread,
May 11, 2008, 1:28:38 AM5/11/08
to TurboGears Trunk
Hello,

I quickstarted a project on tg2, setup the db and created a controller
using crud for tg_user (paster crud -m User).
However, I am getting a NoSuchColumnError: "Could not locate column in
row for column 'tg_groups'".

Regards,
Dax

P.S. DBMechanic rocks!


dakila

unread,
May 11, 2008, 1:40:00 AM5/11/08
to TurboGears Trunk
Added info:
On display (/user/list), I am getting a NoSuchColumnError: "Could not
locate column in row for column 'tg_groups'"

gas...@gmail.com

unread,
May 11, 2008, 12:57:31 PM5/11/08
to TurboGears Trunk
> Added info:
> On display (/user/list), I am getting a NoSuchColumnError: "Could not
> locate column in row for column 'tg_groups'"
>
> dakila wrote:
> > Hello,
>
> > I quickstarted a project on tg2, setup the db and created a controller
> > using crud for tg_user (paster crud -m User).
> > However, I am getting a NoSuchColumnError: "Could not locate column in
> > row for column 'tg_groups'".
>

In this case you could comment out the #dbmachanic = xxx... column in
root.py,
and browse http://..../dbmachanic to manipulate tg_user.


crud is fit for simpler schema usage, you need more skill to customize
crud for relational column.

dakila

unread,
May 12, 2008, 4:28:54 AM5/12/08
to TurboGears Trunk
Hello list,

I am a long time fan of tgCRUD and have been using it in my tg 1.0.xx
projects. I have been trying out tg2 (checked out trunk)
Anyone have some pointers to get started for customizing the code
outputted by crud work for tables with 'many to many' relation (ie:
tg_user >- user_group -< tg_group)?
I have been looking at the dbsprockets and dbmechanic code to
understand it more.
Some parameters like limitFields parameters from makeTable, dont get
passed to makeView?
I am not sure if it is a bug or something,
Although I am still not successful solving the error I mentioned
previously :)

TIA,
Dax

On May 12, 12:57 am, "gaso...@gmail.com" <gaso...@gmail.com> wrote:
> > Added info:
> > On display (/user/list), I am getting a NoSuchColumnError: "Could not
> > locate column in row for column 'tg_groups'"
>
> > dakila wrote:
> > > Hello,
>
> > > I quickstarted a project on tg2, setup the db and created a controller
> > > using crud for tg_user (paster crud -m User).
> > > However, I am getting a NoSuchColumnError: "Could not locate column in
> > > row for column 'tg_groups'".
>
> In this case you could comment out the #dbmachanic = xxx... column in
> root.py,
> and browsehttp://..../dbmachanicto manipulate tg_user.

dakila

unread,
May 13, 2008, 2:44:43 AM5/13/08
to TurboGears Trunk
Hello,

in the create controller, I just changed the
value = provider.select(tableName=self.tablename,values=kw)
to
value = getTableValue(model=User)

It seems getTableValue will work for tables with many to many relation
to other table (ie tg_group).
makeTable returns a datagrid widget that also requires the other
'mapped' properties. However provider.select will only return rows
containing only the columns in the table. Therefor calls by the
datagrid to that column (in this case tg_groups) produces the
NoSuchColumnError: "Could not locate column in row for column
'tg_groups'".

I am not sure if this can be considered a crud bug, since the produced
controller already contains the import statement for getTableValue. If
it is a bug I can create a ticket in trac.

Dax
> > and browsehttp://..../dbmachanictomanipulate tg_user.

gas...@gmail.com

unread,
May 14, 2008, 10:31:47 PM5/14/08
to TurboGears Trunk
On 5月13日, 下午2時44分, dakila <dak...@gmail.com> wrote:
> Hello,
>
> in the create controller, I just changed the
> value = provider.select(tableName=self.tablename,values=kw)
> to
> value = getTableValue(model=User)
>
> It seems getTableValue will work for tables with many to many relation
> to other table (ie tg_group).
> makeTable returns a datagrid widget that also requires the other
> 'mapped' properties. However provider.select will only return rows
> containing only the columns in the table. Therefor calls by the
> datagrid to that column (in this case tg_groups) produces the
> NoSuchColumnError: "Could not locate column in row for column
> 'tg_groups'".
>
> I am not sure if this can be considered a crud bug, since the produced
> controller already contains the import statement for getTableValue. If
> it is a bug I can create a ticket in trac.
>
> Dax


Hi Dax,

Thanks for finding bug,
please create a ticket in trac and we'll check it.

--
Fred

dakila

unread,
May 15, 2008, 2:19:37 AM5/15/08
to TurboGears Trunk
Hi Fred,

Created the ticket http://trac.turbogears.org/ticket/1820

Regards,
Dax

percious

unread,
May 15, 2008, 1:03:53 PM5/15/08
to TurboGears Trunk
This is definitely a bug in crud, which I have not had the opportunity
to fix yet.

In the dbmechanic controller, I scrape out the many-to-many columns
before I call the provider's select method (so you don't get this
error).

cheers.
-chris
Reply all
Reply to author
Forward
0 new messages