give the trunk a try, theres been some fixes to the mapper  
compilation which can affect those properties being set up, and this  
seems to be the same problem.

or, you can say mapper.compile() to force the compilation.

On Jun 20, 2006, at 7:13 PM, Anton Krasovsky wrote:

> Hi,
>
> I see some strange mapper behavior in 0.2.3:
>
> I have few tables like these
>
> node_table = Table("node", __engine__,
>     Column('node_id', Integer, primary_key=True),
>     Column('name_index', Integer, nullable=True),
>     )
>
> host_table = Table("host", __engine__,
>     Column('host_id', Integer, primary_key=True),
>     Column('hostname', String(64), nullable=False,
> unique=True),
>     )
>
> node_name_table = Table("node_name", __engine__,
>     Column('node_name_id', Integer, primary_key=True),
>     Column('node_id', Integer,
> ForeignKey('node.node_id')),
>     Column('host_id', Integer,
> ForeignKey('host.host_id'), unique='index1'),
>     Column('name', String(64), nullable=False,
> unique='index1'),
>     )
>
> subscription_table = Table( "subscription",
> __engine__,
>     Column('subscription_id', Integer,
> primary_key=True),
>     Column('node_id', Integer,
> ForeignKey('node.node_id')),
>     Column('source_name_id', Integer,
> ForeignKey('node_name.node_name_id')),
>     )
>
>
> And some mappers:
>
> node_mapper = mapper(Node, node_table)
>
> host_mapper = mapper(Host, host_table)
>
> node_name_mapper = mapper(NodeName, node_name_table,
> properties = {
>     'node' : relation(Node, backref=backref('names')),
>     'host' : relation(Host),
>     }
> )
>
> subscription_mapper = mapper(Subscription,
> subscription_table, properties = {
>     'node' : relation(Node, backref='subscription'),
>     'source_name' : relation(NodeName),
>     }
> )
>
>
> In 0.2.3 I get error accessing Node instance, saying
> that Node.names does not exists:
>
>>>> objectstore.query(Node).get(1).names
> Traceback (most recent call last):
>   File "<console>", line 1, in ?
> AttributeError: 'Node' object has no attribute 'names'
>
>
> In 0.2.2 everything is fine:
>
>>>> objectstore.query(Node).get(1).names
> [<NodeName object at 0x8da06cc>]
>
> However, even in 0.2.3 following works:
>
>>>> objectstore.query(NodeName).get(1).node.names
> [<NodeName object at 0x8da8a8c>]
>
>
> Regards,
> Anton Krasovsky
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to