Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #342 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

Catwalk add row for table with MultipleJoin or Related join on intermediateTable

Reported by: florian Owned by: anonymous
Priority: high Milestone: 0.9
Component: Toolbox Version:
Severity: blocker Keywords:


I'm on r441

  • I got a simple setup where I do a RelatedJoin?('sometable', intermediateTable='inter',joinColumn='asfd',otherColumn='blubber')
  • When I insert a column for the table containing the RelatedJoin? via sqlobject everything works fine and upon model.hub.commit() the record is on the database.
  • Doing the same via Catwalk doesn't do anything, no error, the record just isn't there.

Change History

comment:1 Changed 13 years ago by florian

This behavior is observed on debian using postgres

comment:2 Changed 13 years ago by anonymous

Note: I do not try to insert a row into an intermediate table. I try to insert the row into one of the joined tables, that contain the RelatedJoin? attribute.

comment:3 Changed 13 years ago by ronald@…

Can you please attatch your model to this ticket?

comment:4 Changed 13 years ago by florian

Project setup

tg-admin quickstart


from sqlobject import *
from turbogears.database import PackageHub

hub = PackageHub("demo")
__connection__ = hub

class foo(SQLObject):
    name = StringCol()
    bars = RelatedJoin('bar',intermediateTable='blubber',joinColumn='foo',otherColumn='bar')

class blubber(SQLObject):
    foo = ForeignKey('foo')
    bar = ForeignKey('bar')

class bar(SQLObject):
    name = StringCol()

class catwalk_state_table(SQLObject):
    state = BLOBCol()

creation sql

Using database URI postgres:///mydemo
    name TEXT

CREATE TABLE catwalk_state_table (
    state BYTEA

    name TEXT

CREATE TABLE blubber (
    foo_id INT, CONSTRAINT foo_id_exists FOREIGN KEY (foo_id) REFERENCES foo (id) ,
    bar_id INT, CONSTRAINT bar_id_exists FOREIGN KEY (bar_id) REFERENCES bar (id)

sqlobject functionality demo

snakepit:/home/turbogears/demo# createdb mydemo
snakepit:/home/turbogears/demo# tg-admin sql create
Using database URI postgres:///mydemo
snakepit:/home/turbogears/demo# tg-admin shell
Python 2.4.1 (#2, May  5 2005, 11:32:06)
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import model
>>> model.foo(name='asdfasdf')
<foo 1L name='asdfasdf'>
>>> model.hub.commit()
snakepit:/home/turbogears/demo# psql mydemo
Welcome to psql 7.4.7, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

mydemo=# \d
                   List of relations
 Schema |            Name            |   Type   | Owner
 public | bar                        | table    | root
 public | bar_id_seq                 | sequence | root
 public | blubber                    | table    | root
 public | blubber_id_seq             | sequence | root
 public | catwalk_state_table        | table    | root
 public | catwalk_state_table_id_seq | sequence | root
 public | foo                        | table    | root
 public | foo_id_seq                 | sequence | root
(8 rows)

mydemo=# select * from foo;
 id |   name
  1 | asdfasdf
(1 row)


Doing the same add over catwalk on foo does not succeed, however on bar it succeedes and also on blubber (selecting the previously created foo and bar)

I get no error message whatsoever of foo not working, it just doesn't do anything. It switches to the created foo view tough, but then when you go on browse, it's not there. - - [2006/01/04 22:56:03] "GET /catwalk/columns?objectName=foo HTTP/1.1" 200 316
2006/01/04 22:56:07 HTTP INFO - POST /catwalk/add HTTP/1.1
2006-01-04 22:56:07,411 turbogears.controllers DEBUG Returning JSON - - [2006/01/04 22:56:07] "POST /catwalk/add HTTP/1.1" 200 451

comment:5 Changed 13 years ago by florian

  • Severity changed from major to blocker

Using r471 here. I noticed the problem is still here. I also tried with tables containing MultipleJoins?, and I get the same effect.

  • If class contains a field with a RelatedJoin? using intermediateTable you cannot add one of those in catwalk
  • If a class contains a field with a MultipleJoin? you can not add one of these in catwalk

comment:6 Changed 13 years ago by anonymous

  • Summary changed from Catwalk custom RelatedJoin to Catwalk add row for table with MultipleJoin or Related join on intermediateTable

Using r485 and it is still the same issue.

Cannot add a row in a Table containing a MultipleJoin? or a RelatedJoin? with an intermediateTable.

comment:7 Changed 13 years ago by florian

Seems solved since r485 sorry.

The table I had in focus has another problem (one I could reproduce in the shell). I assumed it was all the old story over again because it failed to add a row with this specific table and did not bring any error message.

Catwalk should really print the tracebacks when something goes wrong.

comment:8 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed

since the original reporter says that it's solved in [485], I'm going to close the ticket.

Note: See TracTickets for help on using tickets.