Hi

I was wondering if someone might be able to point me in the right
direction. I am aware of the sharding capabilities of SQLAlchemy and
was wondering if anyone has done this using Elixir? Let me give an
example of what I am trying to accomplish:

def setShard(id):
    # do code that will fetch the shard ID based on the input ID
supplied)
    # set the connection to the correct database server
    # ... set ?
   pass

def find_by_id(user_id):
   setShard(user_id)
   User.query.filter_by(user_id = user_id)

I do not want to build logic in each model of how to determine the
shard, it would be much easier if i could just set the connection
before hand, so models like (User) that I use after that would use
that database server.

I was thinking about just setting metadata.bind = db2_server

But since this is an RPC like application, it seems to be this could
have race conditions since metadata is a global yes?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to