擅长:python、mysql、java
<p>不能使用simpledb执行子选择和破坏性操作。在</p>
<p>Amazon提供了引用规则:<a href="http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/QuotingRulesSelect.html" rel="nofollow noreferrer">http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/QuotingRulesSelect.html</a></p>
<p>可以使用以下函数在python中应用此行为:</p>
<pre><code>def quote(string):
return string.replace("'", "''").replace('"', '""').replace('`', '``')
client = boto3.client('sdb')
query = 'SELECT * FROM `%s` WHERE "%s" = "%s"' % (quote(domain), quote(key), quote(value))
response = client.select(SelectExpression = query)
</code></pre>