def read_customers_between(client, min_cust_id, max_cust_id):
    #
    # Extending the previous example to show getting a range between two values.
    #
    res = client.query(
        q.map_(
            lambda x: q.select("data", q.get(q.select(1, x))),
            q.filter_(
                lambda y: q.lte(min_cust_id, q.select(0, y)),
                q.paginate(q.match(q.index("customer_id_filter")),
                           before=[max_cust_id]))))
    print('Query for id\'s > {0} and < {1} : {2}'.format(
        min_cust_id, max_cust_id, res))
 def test_lte(self):
     self.assertJson(query.lte(1), '{"lte":1}')
     self.assertJson(query.lte(1, 2, 3), '{"lte":[1,2,3]}')
     self.assertJson(query.lte([1, 2, 3]), '{"lte":[1,2,3]}')
Esempio n. 3
0
 def test_lte(self):
     self.assertTrue(self._q(query.lte(1, 1)))