Thanks for the quick response, Michael.

We are mapping the classes dynamically, and we patched an in-house
copy of SQLAlchemy 0.5.6 with the stricter mutex from SQLAlchemy 0.6
to fix the sporadic "mappers failed to compile" errors we were seeing
under production load.

We also added a Least Recently Used cache for these dynamically mapped
tables because we needed the memory usage to max out at something
reasonable.

When I get a chance, I'll play with UsageRecipes/EntityName to see if
differs from our current approach in any significant ways. In the mean
time, I'm stuck on another sharding question... which I might ask
shortly ;)

Thanks again for your time,

--diana

On Fri, Jan 8, 2010 at 10:32 AM, Michael Bayer <mike...@zzzcomputing.com> wrote:
> how does your application want to reference these tables ?   while this
> might be a little memory consuming I'd probably look into generating
> mappers, Tables, and classes dynamically ala the recipe
> http://www.sqlalchemy.org/trac/wiki/UsageRecipes/EntityName .   If the
> table is chosen based on the attributes of the class, I'd create new
> instances of the class using a factory function:
>
> for i in range(1, M):
>    table = Table("circle_%d" % i, ...)
>    my_registry_of_classes["Circle_%d" % i] = \
>     map_class_to_some_table(CircleBase, table, "Circle_%d" % i)
>
> def myobject(circle):
>    return my_registry_of_classes["Circle_%d"% circle]()
>
> x = myobject(circle=5)
-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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