You have to manually order the creation of tables.  Include this near
the top of your model.py:

soClasses = (
    'Team',
    'Player')

Player references Team (the ForeignKey), so Team needs to be created
first.

This requirement is specific to PG, but your model will continue to work
with other DB systems.

Stuart


On Thu, 2006-11-30 at 16:41 -0800, Suren wrote:
> This error seem to be a very common one but a clean solution is
> elusive.
> 
> Using database URI postgres://postgres:[EMAIL PROTECTED]/fooball
> .........stack trace............
> psycopg2.ProgrammingError: relation "team" does not exist'
> 
> I am trying to follow the tutorial
> 
> http://docs.turbogears.org/1.0/IntroductionToWidgets
> 
> and want to use postgresql as that is our environment at work. It is
> linux based but for now I am trying this stuff on windows. I got
> turbogears a couple of days back...
> 
> from sqlobject import *
> soClasses = ('Player','Team')
> from turbogears.database import PackageHub
> 
> hub = PackageHub("Fooball")
> __connection__ = hub
> 
> # class YourDataClass(SQLObject):
> #     pass
> import datetime
> 
> class Player(SQLObject):
>    name = StringCol(length=40, alternateID=True)
>    birthdate = DateCol(notNull=True)
> 
>    team = ForeignKey('Team')
> 
>    points = IntCol(default=0)
> 
> class Team(SQLObject):
>    city = StringCol(length=20, notNull=True)
>    nickname = StringCol(length=20, notNull=True, alternateID=True)
> 
>    players = MultipleJoin('Player')
> 
> 
> Folks here keep mentioning about a 279 patch..what is it and how can I
> get it? I checked the trunks for SQLObject and they did not have the
> same solution that was atleast proposed in 279. Can someone point me to
> a place where I can have these errors fixed?
> 
> I will try the creation manually but it would be nice to have a working
> tutorial for all databases for newbies like me. Thank ya..
> 
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to