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


Python Select.columns方法代码示例

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


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

示例1: test_join_root_field

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import columns [as 别名]
 def test_join_root_field(self):
     # join(table, '.Field1')
     # JOIN table ON (root_table.Field1 = table.Field1)
     q = Select()
     sql_t = q.columns(['t1c1', 't2c1']).from_table('t1').left_join('t2', '.t1c1').sql()
     assert_equals(sql_t, ('SELECT `t1c1`, `t2c1` FROM t1 LEFT JOIN t2 ON (t1.`t1c1` = t2.`t1c1`)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:8,代码来源:test_select.py

示例2: test_join_no_root

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import columns [as 别名]
 def test_join_no_root(self):
     q = Select()
     q.columns(['t1c1', 't2c1']).left_join('t2', 't1c1').sql()
开发者ID:lovette,项目名称:mysqlstmt,代码行数:5,代码来源:test_select.py

示例3: test_join_field

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import columns [as 别名]
 def test_join_field(self):
     # join(table, 'Field1')
     # JOIN table USING (Field1)
     q = Select()
     sql_t = q.columns(['t1c1', 't2c1']).from_table('t1').left_join('t2', 't1c1').sql()
     assert_equals(sql_t, ('SELECT `t1c1`, `t2c1` FROM t1 LEFT JOIN t2 USING (`t1c1`)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:8,代码来源:test_select.py

示例4: test_join_root_field_multi_dotdot

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import columns [as 别名]
 def test_join_root_field_multi_dotdot(self):
     # join(table, '..Field1')
     # JOIN table ON (previous_join_table.Field1 = table.Field1)
     q = Select()
     sql_t = q.columns(['t1c1', 't2c1', 't3c1']).from_table('t1').left_join('t2', '..t1c1').left_join('t3', '..t2c1').sql()
     assert_equals(sql_t, ('SELECT `t1c1`, `t2c1`, `t3c1` FROM t1 LEFT JOIN t2 ON (t1.`t1c1` = t2.`t1c1`) LEFT JOIN t3 ON (t2.`t2c1` = t3.`t2c1`)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:8,代码来源:test_select.py

示例5: test_join_root_field_tableas

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import columns [as 别名]
 def test_join_root_field_tableas(self):
     # join(table, '.Field1')
     # JOIN table ON (root_table.Field1 = table.Field1)
     q = Select()
     sql_t = q.columns(['t1a.c1', 't2a.c1']).from_table('t1 AS t1a').left_join('t2 AS t2a', '.t1c1').sql()
     assert_equals(sql_t, ('SELECT t1a.`c1`, t2a.`c1` FROM t1 AS t1a LEFT JOIN t2 AS t2a ON (t1a.`t1c1` = t2a.`t1c1`)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:8,代码来源:test_select.py

示例6: test_join_conditions

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import columns [as 别名]
 def test_join_conditions(self):
     # join(table, [condition,...])
     # JOIN table ON (condition [AND condition [AND ...]])
     q = Select()
     sql_t = q.columns(['t1c1', 't2c1']).from_table('t1').left_join('t2', ['t1c1 = t2c1']).sql()
     assert_equals(sql_t, ('SELECT `t1c1`, `t2c1` FROM t1 LEFT JOIN t2 ON (t1c1 = t2c1)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:8,代码来源:test_select.py

示例7: test_join_field_list

# 需要导入模块: from mysqlstmt import Select [as 别名]
# 或者: from mysqlstmt.Select import columns [as 别名]
 def test_join_field_list(self):
     # when join_cond is ('Field1', 'Field2', ...)
     # JOIN table USING (Field1, Field2, ...)
     q = Select()
     sql_t = q.columns(['t1c1', 't2c1']).from_table('t1').left_join('t2', ('t1c1', 't2c1')).sql()
     assert_equals(sql_t, ('SELECT `t1c1`, `t2c1` FROM t1 LEFT JOIN t2 USING (`t1c1`, `t2c1`)', None))
开发者ID:lovette,项目名称:mysqlstmt,代码行数:8,代码来源:test_select.py

示例8: test_constructor_table_name

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


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