I did some tests on a new project and found this error; I defined this test
model inside a plugin:
class Sample(DeclarativeBase):
__tablename__ = 'test1_samples'
uid = Column(Integer, autoincrement=True, primary_key=True)
name = Column(Unicode(16))
class Tag(DeclarativeBase):
__tablename__ = 'tag'
id = Column(Integer, autoincrement=True, primary_key=True)
text= Column(Unicode(200))
class Article(DeclarativeBase):
__tablename__ = 'article'
id = Column(Integer, autoincrement=True, primary_key=True)
text= Column(Unicode(2000) )
uid_sample = Column(Integer, ForeignKey(Sample.uid))
tags = relation(Tag, secondary=lambda: tag_article, backref='articles')
tag_article= Table('tag_article', metadata,
Column('tag_id', Integer, ForeignKey(Tag.id), primary_key=True),
Column('article_id', Integer, ForeignKey(Article.id),
primary_key=True),)
I tried running setup-app and I got this error:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) relation "tag" does not
exist
'\nCREATE TABLE tag_article (\n\ttag_id INTEGER NOT NULL, \n\tarticle_id
INTEGER NOT NULL, \n\tPRIMARY KEY (tag_id, article_id), \n\tFOREIGN
KEY(tag_id) REFERENCES tag (id), \n\tFOREIGN KEY(article_id) REFERENCES
article (id)\n)\n\n' {}
If, instead, I remove "uid_sample = Column(Integer,
ForeignKey(Sample.uid))" from the article table everything works fine
Using Lazy changes nothing
Why?
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.