boto python dynamodb scan attributes_to_get -


folks, docs boto vague @ best, why operation not working?

from boto.dynamodb2.table import table import time  print "scanning existing database"  mytable = table('mytable')  start = time.clock()  my_query = mytable.scan(scan_filter=none, attributes_to_get=['something']) results = [] x in my_query:     results.append(x['something'])  elapsed = (time.clock() - start) print "scan operation took",elapsed print len(results) 

why work:

#!/bin/env python  import boto db = boto.connect_dynamodb()  import time  print "scanning existing database"  table = db.get_table('current_fhv_drivers')  start = time.clock()  all_query = table.scan(attributes_to_get=['something']) results = [] x in all_query:     results.append(x['something'])  elapsed = (time.clock() - start) print "scan operation took",elapsed print len(results) 

seems you're trying table before creating connection. try:

import boto import boto.dynamodb2 boto.dynamodb2.table import table  conn = boto.dynamodb2.connect_to_region(     'us-east-1',     aws_access_key_id=aws_access_key_id,     aws_secret_access_key=aws_secret_access_key ) mytable = table('mytable', connection=conn) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -