Пример #1
0
 def test_condition_multi(self):
     names, values = ['first', 'last'], ['foo', 'bar']
     conditions = [eq(name, value) for name, value in zip(names, values)]
     where = Where(*conditions)
     self.assertEquals(where.cql,
                       ' AND '.join(cond.cql for cond in conditions))
     self.assertEquals(where.values, values)
Пример #2
0
 def get_query(self, assignment, condition, using=None):
     query = 'UPDATE {}'.format(self.column_family)
     if using:
         query = '{} {}'.format(query, using.cql)
     assignments = Assignments()
     assignments.add(assignment)
     where = Where(condition)
     return '{} SET {} WHERE {}'.format(query, assignments.cql, where.cql)
Пример #3
0
 def test_condition_single(self):
     cond = eq('name', 'foo')
     where = Where(cond)
     self.assertEquals(where.cql, cond.cql)
     self.assertEquals(where.values, cond.values)
Пример #4
0
	def where(self, *args):
		self.conditions = Where(*args)
		return self
Пример #5
0
 def get_query(self, selection, condition=None):
     query = 'SELECT {} FROM {}'.format(selection.cql, self.column_family)
     if condition:
         where = Where(condition)
         query = '{} WHERE {}'.format(query, where.cql)
     return query