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


Python Attr.eq方法代码示例

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


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

示例1: test_reset

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
    def test_reset(self):
        a = Attr("myattr")
        self.assert_condition_expression_build(a.eq("foo"), "#n0 = :v0", {"#n0": "myattr"}, {":v0": "foo"})

        self.assert_condition_expression_build(a.eq("foo"), "#n1 = :v1", {"#n1": "myattr"}, {":v1": "foo"})

        self.builder.reset()
        self.assert_condition_expression_build(a.eq("foo"), "#n0 = :v0", {"#n0": "myattr"}, {":v0": "foo"})
开发者ID:mtdowling,项目名称:boto3,代码行数:10,代码来源:test_conditions.py

示例2: test_build_double_nested_and_or

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_double_nested_and_or(self):
     a = Attr('myattr')
     a2 = Attr('myattr2')
     self.assert_condition_expression_build(
         (a.eq('foo') & a2.eq('foo2')) | (a.eq('bar') & a2.eq('bar2')),
         '((#n0 = :v0 AND #n1 = :v1) OR (#n2 = :v2 AND #n3 = :v3))',
         {'#n0': 'myattr', '#n1': 'myattr2', '#n2': 'myattr',
          '#n3': 'myattr2'},
         {':v0': 'foo', ':v1': 'foo2', ':v2': 'bar', ':v3': 'bar2'})
开发者ID:boto,项目名称:boto3,代码行数:11,代码来源:test_conditions.py

示例3: test_build_double_nested_and_or

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_double_nested_and_or(self):
     a = Attr("myattr")
     a2 = Attr("myattr2")
     self.assert_condition_expression_build(
         (a.eq("foo") & a2.eq("foo2")) | (a.eq("bar") & a2.eq("bar2")),
         "((#n0 = :v0 AND #n1 = :v1) OR (#n2 = :v2 AND #n3 = :v3))",
         {"#n0": "myattr", "#n1": "myattr2", "#n2": "myattr", "#n3": "myattr2"},
         {":v0": "foo", ":v1": "foo2", ":v2": "bar", ":v3": "bar2"},
     )
开发者ID:mtdowling,项目名称:boto3,代码行数:11,代码来源:test_conditions.py

示例4: test_build_or

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_or(self):
     a = Attr("myattr")
     a2 = Attr("myattr2")
     self.assert_condition_expression_build(
         a.eq("foo") | a2.eq("bar"),
         "(#n0 = :v0 OR #n1 = :v1)",
         {"#n0": "myattr", "#n1": "myattr2"},
         {":v0": "foo", ":v1": "bar"},
     )
开发者ID:mtdowling,项目名称:boto3,代码行数:11,代码来源:test_conditions.py

示例5: test_reset

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
    def test_reset(self):
        a = Attr('myattr')
        self.assert_condition_expression_build(
            a.eq('foo'), '#n0 = :v0', {'#n0': 'myattr'}, {':v0': 'foo'})

        self.assert_condition_expression_build(
            a.eq('foo'), '#n1 = :v1', {'#n1': 'myattr'}, {':v1': 'foo'})

        self.builder.reset()
        self.assert_condition_expression_build(
            a.eq('foo'), '#n0 = :v0', {'#n0': 'myattr'}, {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:13,代码来源:test_conditions.py

示例6: test_build_nested_attr_map_list

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_nested_attr_map_list(self):
     a = Attr('MyMap.MyList[2].MyElement')
     self.assert_condition_expression_build(
         a.eq('foo'), '#n0.#n1[2].#n2 = :v0',
         {'#n0': 'MyMap', '#n1': 'MyList', '#n2': 'MyElement'},
         {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:8,代码来源:test_conditions.py

示例7: test_build_attr_list

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_attr_list(self):
     a = Attr('MyList[0]')
     self.assert_condition_expression_build(
         a.eq('foo'), '#n0[0] = :v0', {'#n0': 'MyList'}, {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:6,代码来源:test_conditions.py

示例8: test_build_attr_map

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_attr_map(self):
     a = Attr('MyMap.MyKey')
     self.assert_condition_expression_build(
         a.eq('foo'), '#n0.#n1 = :v0', {'#n0': 'MyMap', '#n1': 'MyKey'},
         {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:7,代码来源:test_conditions.py

示例9: test_build_with_is_key_condition_throws_error

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_with_is_key_condition_throws_error(self):
     a = Attr('myattr')
     with self.assertRaises(DynamoDBNeedsKeyConditionError):
         self.builder.build_expression(a.eq('foo'), is_key_condition=True)
开发者ID:boto,项目名称:boto3,代码行数:6,代码来源:test_conditions.py

示例10: test_build_attribute_with_attr_value

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_attribute_with_attr_value(self):
     a = Attr('myattr')
     value = Attr('myreference')
     self.assert_condition_expression_build(
         a.eq(value), '#n0 = #n1',
         {'#n0': 'myattr', '#n1': 'myreference'}, {})
开发者ID:boto,项目名称:boto3,代码行数:8,代码来源:test_conditions.py

示例11: test_build_not

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_not(self):
     a = Attr('myattr')
     self.assert_condition_expression_build(
         ~a.eq('foo'), '(NOT #n0 = :v0)',
         {'#n0': 'myattr'}, {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:7,代码来源:test_conditions.py

示例12: test_build_or

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_or(self):
     a = Attr('myattr')
     a2 = Attr('myattr2')
     self.assert_condition_expression_build(
         a.eq('foo') | a2.eq('bar'), '(#n0 = :v0 OR #n1 = :v1)',
         {'#n0': 'myattr', '#n1': 'myattr2'}, {':v0': 'foo', ':v1': 'bar'})
开发者ID:boto,项目名称:boto3,代码行数:8,代码来源:test_conditions.py

示例13: test_build_nested_attr_map_list

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_nested_attr_map_list(self):
     a = Attr("MyMap.MyList[2].MyElement")
     self.assert_condition_expression_build(
         a.eq("foo"), "#n0.#n1[2].#n2 = :v0", {"#n0": "MyMap", "#n1": "MyList", "#n2": "MyElement"}, {":v0": "foo"}
     )
开发者ID:mtdowling,项目名称:boto3,代码行数:7,代码来源:test_conditions.py

示例14: test_build_attr_list

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_attr_list(self):
     a = Attr("MyList[0]")
     self.assert_condition_expression_build(a.eq("foo"), "#n0[0] = :v0", {"#n0": "MyList"}, {":v0": "foo"})
开发者ID:mtdowling,项目名称:boto3,代码行数:5,代码来源:test_conditions.py

示例15: test_build_attr_map

# 需要导入模块: from boto3.dynamodb.conditions import Attr [as 别名]
# 或者: from boto3.dynamodb.conditions.Attr import eq [as 别名]
 def test_build_attr_map(self):
     a = Attr("MyMap.MyKey")
     self.assert_condition_expression_build(
         a.eq("foo"), "#n0.#n1 = :v0", {"#n0": "MyMap", "#n1": "MyKey"}, {":v0": "foo"}
     )
开发者ID:mtdowling,项目名称:boto3,代码行数:7,代码来源:test_conditions.py


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