I have started a new project with tg 2.2 and tgext.pluggable 0.2.0 and 
created a new plugin with gearbox
I added this after the example model:

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) )

    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))

When i run paster setup-app development.ini, plugged module returns this 
error:

  File 
"/home/luca/test_plugin/eggs/SQLAlchemy-0.7.10-py2.7-linux-x86_64.egg/sqlalchemy/sql/util.py",
 
line 23, in visit_foreign_key
    parent_table = fkey.column.table
  File 
"/home/luca/test_plugin/eggs/SQLAlchemy-0.7.10-py2.7-linux-x86_64.egg/sqlalchemy/util/langhelpers.py",
 
line 496, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File 
"/home/luca/test_plugin/eggs/SQLAlchemy-0.7.10-py2.7-linux-x86_64.egg/sqlalchemy/schema.py",
 
line 1344, in column
    if isinstance(self._colspec, basestring):
  File 
"/home/luca/test_plugin/eggs/tgext.pluggable-0.2.0-py2.7.egg/tgext/pluggable/adapt_models.py",
 
line 44, in _colspec
    return self._original_colspec()
TypeError: 'InstrumentedAttribute' object is not callable

I have tried LazyForeignKey but nothing changed


Il giorno giovedì 2 maggio 2013 17:10:29 UTC+2, Alessandro Molina ha 
scritto:
>
> Have you tried with the last 0.2.0 release of tgext.pluggable? My example 
> was tested and working on that codebase, so I'm pretty confident that it 
> should work for you too if you upgrade pluggable.
>
>
> On Thu, May 2, 2013 at 10:10 AM, Luca Verardi 
> <[email protected]<javascript:>
> > wrote:
>
>> For the main project and plugged project i use:
>> from sqlalchemy.ext.declarative import declarative_base
>> DeclarativeBase = declarative_base()
>> metadata = DeclarativeBase.metadata
>>
>>
>> Il giorno giovedì 2 maggio 2013 10:06:35 UTC+2, Luca Verardi ha scritto:
>>
>>> I use the same metadata from all.
>>>
>>> Il giorno giovedì 18 aprile 2013 16:53:52 UTC+2, Alessandro Molina ha 
>>> scritto:
>>>>
>>>> What is it "metadata" you use in tag_article Table definition? Might it 
>>>> be that the two tables are registered in different metadata?
>>>>
>>>>
>>>> On Thu, Apr 18, 2013 at 4:34 PM, Luca Verardi <[email protected]>wrote:
>>>>
>>>>> I'm getting an error even with lambda.
>>>>>
>>>>> sqlalchemy.exc.**ProgrammingError: (ProgrammingError) relation 
>>>>> "article" 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' {}
>>>>>
>>>>> The tables I'm declaring have nothing to do with the main project
>>>>>
>>>>>
>>>>> 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) )
>>>>>
>>>>>     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))
>>>>>
>>>>>
>>>>>
>>>>>  -- 
>>>>> 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 turbogears+...@googlegroups.**com.
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at 
>>>>> http://groups.google.com/**group/turbogears?hl=en<http://groups.google.com/group/turbogears?hl=en>
>>>>> .
>>>>> For more options, visit 
>>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>>  
>>>>>  
>>>>>
>>>>
>>>>  -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/turbogears?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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.


Reply via email to