Hi,

I'm using the association_proxy example:
http://www.sqlalchemy.org/docs/05/reference/ext/associationproxy.html?highlight=associationproxy#building-complex-views

The example uses this mapper definition:
mapper(Broker, brokers_table, properties={
    'by_stock': relation(Holding,
        collection_class=attribute_mapped_collection('stock'))
})

Since I use the DeclarativeBase for my model I tried this:

class Broker(DeclarativeBase):
    ...
    __mapper_args__ = {'by_stock': relation(Holding,
collection_class=attribute_mapped_collection('stock'))}

The __mapper_args__ is what what I found over here:
http://www.sqlalchemy.org/docs/05/reference/ext/declarative.html#mapper-configuration

But unfortunately, I got this error when creating the database.

    return Mapper(class_, local_table, *args, **params)
TypeError: Error when calling the metaclass bases
    __init__() got an unexpected keyword argument 'by_stock'

What is the right way to accomplish this?
I also hope that gets added to the documentation, or as an example in
the SA distribution.

Cheers,
Kees

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to