The first link you gave have exactly the thing I said I don't want to do.
The second one is however looks very promising.

Have I understand correctly that I need to create custom Session class and 
custom Query class for this session that would somehow produce correct from 
clause (with correct table name) from a statement like that

session.query(ShardedEntity).filter(ShardedEntity.some_unique_name=='foo')

If so, than could you give a little more guidance on it? Like what methods 
from query do I need do override etc?

On Thursday, 19 May 2016 18:30:51 UTC+3, Mike Bayer wrote:
>
>
>
> Well if you want to see some examples of on-the-fly mappers for 
> different databases that nonetheless map to the same class take a look 
> at https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/EntityName. 
>     The kind of thing you're doing has been done before but it's not 
> totally easy. 
>
>
> Along with the entity name thing, you can customize Session as well as 
> how it generates a query.  If you look at the source to the horizontal 
> sharding extension 
>
> http://docs.sqlalchemy.org/en/latest/orm/extensions/horizontal_shard.html?highlight=horizontal#module-sqlalchemy.ext.horizontal_shard
>  
> and maybe also my post at 
>
> http://techspot.zzzeek.org/2012/01/11/django-style-database-routers-in-sqlalchemy/
>  
> <http://www.google.com/url?q=http%3A%2F%2Ftechspot.zzzeek.org%2F2012%2F01%2F11%2Fdjango-style-database-routers-in-sqlalchemy%2F&sa=D&sntz=1&usg=AFQjCNHCTZJLLutlOvl1P_S-Ua1Fn4MwHg>
>  
> you can get some ideas for how to game things on the Session side. 
>
> Those are the two tools you'd be working with here so hopefully you can 
> find a way to combine them in a way that works for you. 
>
>
>
>
> > 
> > I haven't created the issue because I didn't know if solution (not a 
> > workaround like mentioned in stackoverflow) already possible with 
> > sqlalchemy. If not it would be beneficial to add I think. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "sqlalchemy" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to sqlalchemy+...@googlegroups.com <javascript:> 
> > <mailto:sqlalchemy+unsubscr...@googlegroups.com <javascript:>>. 
> > To post to this group, send email to sqlal...@googlegroups.com 
> <javascript:> 
> > <mailto:sqlal...@googlegroups.com <javascript:>>. 
> > Visit this group at https://groups.google.com/group/sqlalchemy. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to