def get_database_from_key(self, key, slave=False):
        """
        Given a key, which is defined by the partition and used to route queries, returns the
        database connection alias which the data lives on.
        """
        return self.get_database(key % self.model._shards.num_shards, slave=slave)
dataset/ETHPy150Open disqus/sharding-example/sqlshards/db/shards/manager.py/MasterPartitionManager.get_database_from_key/original