当前位置: 首页>>代码示例>>Python>>正文


Python Select.from_table方法代码示例

本文整理汇总了Python中mysqlstmt.Select.from_table方法的典型用法代码示例。如果您正苦于以下问题:Python Select.from_table方法的具体用法?Python Select.from_table怎么用?Python Select.from_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysqlstmt.Select的用法示例。


在下文中一共展示了Select.from_table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_where_value_object

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_value_object(self):
     class TestClass(object):
         def __str__(self):
             return "object as a string"
     q = Select()
     sql_t = q.from_table('t1').where_value('t1c1', TestClass()).sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE `t1c1` = ?', ['object as a string']))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:9,代码来源:test_select.py

示例2: test_where_value_in_single

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_value_in_single(self):
     q = Select()
     sql_t = q.from_table('t1').where_value('t1c1', [1]).sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE `t1c1` = 1', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例3: test_select_quote_col_func

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_select_quote_col_func(self):
     q = Select()
     sql_t = q.from_table('t1').columns('DATE(`t1c1`)').sql()
     assert_equals(sql_t, ('SELECT DATE(`t1c1`) FROM t1', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例4: test_select_cols_tuple

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_select_cols_tuple(self):
     q = Select()
     sql_t = q.from_table('t1').columns(('t1c1', 't1c2')).sql()
     assert_equals(sql_t, ('SELECT `t1c1`, `t1c2` FROM t1', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例5: test_qualify_columns

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_qualify_columns(self):
     q = Select()
     sql_t = q.from_table('t1').columns(('t1c1', 't1c2')).qualify_columns('t1', ('t1c1',)).sql()
     assert_equals(sql_t, ('SELECT t1.`t1c1`, `t1c2` FROM t1', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例6: test_where_value_utf_noparam

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_value_utf_noparam(self):
     q = Select(placeholder=False)
     sql = q.from_table('t1').where_value('t1c1', u'"äöü"').sql()
     assert_equals(sql, u'SELECT * FROM t1 WHERE `t1c1` = "äöü"')
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例7: test_where_value_utf_param

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_value_utf_param(self):
     q = Select()
     sql_t = q.from_table('t1').where_value('t1c1', u"äöü").sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE `t1c1` = ?', [u"äöü"]))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例8: test_where_and_multi

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_and_multi(self):
     q = Select()
     sql_t = q.from_table('t1').where_value('t1c1', 1).where_and().where_value('t1c2', 5).where_and().where_value('t1c1', 6).sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE (`t1c1` = 1 OR `t1c2` = 5 OR `t1c1` = 6)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例9: test_having_value_and_or

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_having_value_and_or(self):
     q = Select()
     sql_t = q.from_table('t1').having_and().having_value('t1c1', 1).having_value('t1c2', 5).having_and().having_value('t1c1', 6).having_value('t1c2', 10).sql()
     assert_equals(sql_t, ('SELECT * FROM t1 HAVING ((`t1c1` = 1 AND `t1c2` = 5) OR (`t1c1` = 6 AND `t1c2` = 10))', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例10: test_having_value_or

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_having_value_or(self):
     q = Select()
     sql_t = q.from_table('t1').having_or().having_value('t1c1', 3).having_value('t1c1', 5).sql()
     assert_equals(sql_t, ('SELECT * FROM t1 HAVING (`t1c1` = 3 OR `t1c1` = 5)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例11: test_join_using_where_expr

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_join_using_where_expr(self):
     q = Select()
     sql_t = q.from_table(['t1', 't2']).where_expr('(t1.t1c1 = t2.t2c1)').sql()
     assert_equals(sql_t, ('SELECT * FROM t1, t2 WHERE (t1.t1c1 = t2.t2c1)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例12: test_where_raw_value_between_tuple_param

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_raw_value_between_tuple_param(self):
     q = Select()
     sql_t = q.from_table('t1').where_raw_value('t1c1', '? AND ?', 'BETWEEN', value_params=('a', 'b')).sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE `t1c1` BETWEEN ? AND ?', ['a', 'b']))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例13: test_where_raw_value_between

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_raw_value_between(self):
     q = Select()
     sql_t = q.from_table('t1').where_raw_value('t1c1', '1 AND 5', 'BETWEEN').sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE `t1c1` BETWEEN 1 AND 5', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例14: test_where_value_notlike

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_value_notlike(self):
     q = Select()
     sql_t = q.from_table('t1').where_value('t1c1', 'abc%', 'NOT LIKE').sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE `t1c1` NOT LIKE ?', ['abc%']))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py

示例15: test_where_value_notin_single_alt

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import from_table [as 别名]
 def test_where_value_notin_single_alt(self):
     q = Select()
     sql_t = q.from_table('t1').where_value('t1c1', [1], 'NOT IN').sql()
     assert_equals(sql_t, ('SELECT * FROM t1 WHERE `t1c1` <> 1', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:6,代码来源:test_select.py


注:本文中的mysqlstmt.Select.from_table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。