本文整理汇总了Python中pypika.Query.select方法的典型用法代码示例。如果您正苦于以下问题:Python Query.select方法的具体用法?Python Query.select怎么用?Python Query.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypika.Query
的用法示例。
在下文中一共展示了Query.select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_select_no_from
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_select_no_from(self):
q = Query.select(1)
self.assertEqual('SELECT 1', str(q))
示例2: test_select__no_table
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_select__no_table(self):
q = Query.select(1, 2, 3)
self.assertEqual('SELECT 1,2,3', str(q))
示例3: test_select_then_add_table
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_select_then_add_table(self):
q = Query.select(1).select(2, 3).from_('abc').select('foo')
self.assertEqual('SELECT 1,2,3,"foo" FROM "abc"', str(q))
示例4: test__lower__str
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test__lower__str(self):
q = Query.select(fn.Lower('ABC'))
self.assertEqual("SELECT LOWER('ABC')", str(q))
示例5: test__length__str
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test__length__str(self):
q = Query.select(fn.Length('ABC'))
self.assertEqual("SELECT LENGTH('ABC')", str(q))
示例6: test_utc_timestamp
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_utc_timestamp(self):
query = Query.select(fn.UtcTimestamp())
self.assertEqual("SELECT UTC_TIMESTAMP()", str(query))
示例7: test__insert__str
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test__insert__str(self):
q = Query.select(fn.Insert('Quadratic', 3, 4, 'What'))
self.assertEqual("SELECT INSERT('Quadratic',3,4,'What')", str(q))
示例8: test__bin__str
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test__bin__str(self):
q = Query.select(fn.Bin('2'))
self.assertEqual("SELECT BIN('2')", str(q))
示例9: test__bin__int
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test__bin__int(self):
q = Query.select(fn.Bin(2))
self.assertEqual("SELECT BIN(2)", str(q))
示例10: test__ascii__str
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test__ascii__str(self):
q = Query.select(fn.Ascii('2'))
self.assertEqual("SELECT ASCII('2')", str(q))
示例11: test__ascii__int
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test__ascii__int(self):
q = Query.select(fn.Ascii(2))
self.assertEqual("SELECT ASCII(2)", str(q))
示例12: test_instance_from_function_removed_after_called
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_instance_from_function_removed_after_called(self):
with self.assertRaises(AttributeError):
Query.select(1).from_('abc').from_('efg')
示例13: test_current_time
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_current_time(self):
query = Query.select(fn.CurTime())
self.assertEqual("SELECT CURRENT_TIME()", str(query))
示例14: test_current_date
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_current_date(self):
query = Query.select(fn.CurDate())
self.assertEqual("SELECT CURRENT_DATE()", str(query))
示例15: test_select_no_with_alias_from
# 需要导入模块: from pypika import Query [as 别名]
# 或者: from pypika.Query import select [as 别名]
def test_select_no_with_alias_from(self):
q = Query.select(ValueWrapper(1, 'test'))
self.assertEqual('SELECT 1 "test"', str(q))