Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python AWS Boto:scan()未知关键字';限制';_Python_Python 2.7_Amazon Web Services_Amazon Dynamodb_Database Scan - Fatal编程技术网

Python AWS Boto:scan()未知关键字';限制';

Python AWS Boto:scan()未知关键字';限制';,python,python-2.7,amazon-web-services,amazon-dynamodb,database-scan,Python,Python 2.7,Amazon Web Services,Amazon Dynamodb,Database Scan,以前有人见过这个吗 import boto conn = boto.dynamodb.connect_to_region('eu-west-1', aws_access_key_id=aws_key, aws_secret_access_key=aws_secret) table = conn.get_table('TweetSample') print table.scan(limit=1) 错误: Traceback (most recent call last): File "tes

以前有人见过这个吗

import boto

conn = boto.dynamodb.connect_to_region('eu-west-1', aws_access_key_id=aws_key, aws_secret_access_key=aws_secret)
table = conn.get_table('TweetSample')

print table.scan(limit=1)
错误:

Traceback (most recent call last):
File "test.py", line 9, in <module>
print table.scan(limit=1)
File "table.py", line 518, in scan
return self.layer2.scan(self, *args, **kw)
TypeError: scan() got an unexpected keyword argument 'limit'
[Finished in 0.4s with exit code 1]
回溯(最近一次呼叫最后一次):
文件“test.py”,第9行,在
打印表格扫描(限制=1)
扫描中第518行的文件“table.py”
返回self.layer2.scan(self,*args,**kw)
TypeError:scan()获得意外的关键字参数“limit”
[完成时间为0.4s,退出代码为1]

我甚至不知道……

根据文档,of(由返回的)不接受
限制
,但
最大结果

结果就是一个发电机。因此,如果要打印它,您应该迭代它:

import boto.dynamodb

conn = boto.dynamodb.connect_to_region(
    'eu-west-1',
    aws_access_key_id=aws_key,
    aws_secret_access_key=aws_secret)
table = conn.get_table('TweetSample')
for row in table.scan(max_results=1):
    print row
或将其转换为序列:

print list(table.scan(max_results=1))