def basic_test_2(self): c_1 = Column(str, 'c1') c_2 = Column(int, 'c2') q = Query([c_1, c_2], 'test') q.filter(or_(c_1 == 10, c_2 == 10)) expected_query = 'SELECT c1, c2 FROM ' +\ '' + DATABASE_NAME + '.test WHERE _PARTITIONTIME BETWEEN ' +\ 'TIMESTAMP(\'2010-01-01\') AND ' +\ 'TIMESTAMP(\'2030-01-01\')' self.assertEquals(q.assemble(), expected_query)
def test_query_filter_4(self): table_name = 'testing' c_1 = Column(str, 'column_1') c_2 = Column(str, 'column_2') q = Query([c_1, c_2], table_name) q = q.filter(c_1 >= 'test') q = q.filter(c_2 == 'test2') expected_response = 'SELECT column_1, column_2 FROM ' + \ self.table_date_range + ' AND ' + \ 'column_1 >= \'test\' AND column_2 = \'test2\'' response = q.assemble() self.assertEquals(expected_response, response)
def test_query_filter_2(self): table_name = 'testing' c_1 = Column(str, 'column_1') c_2 = Column(str, 'column_2') q = Query([c_1, c_2], table_name) # Wrong comparision q = q.filter(c_1 == 10) expected_response = 'SELECT column_1, column_2 FROM ' + \ self.table_date_range response = q.assemble() self.assertEquals(expected_response, response)