Giter Club home page Giter Club logo

Comments (2)

trevorrowe avatar trevorrowe commented on June 6, 2024

No, it is not necessary. The issue is the SDK does not know what or how many attributes you require. In the abscence of the list of attributes to select, it will request only the table schema attributes. In your example, this is "id" and "date". The table schema attributes are required so the yielded Item object will know how to operate on itsel f (for example, what if you only wanted to delete each yielded item, you would need to know its schema attributes).

If you pass in a list of attributes to select, the block will instead yield an ItemData object (instead of an Item object).

table.items.query(:select => [ATTRIBUTES_TO_SELECT], :hash_value => "1", :range_value => "22") do |item_data|
    puts item_data.attributes #=> a hash of selected attributes
    item_data.item #=> the AWS::DynamoDB::Item object for this attribute bag
end

from aws-sdk-ruby.

qminhdo avatar qminhdo commented on June 6, 2024

Thanks for clarify. As reference in Doc: Item objects do not have any attribute data populated. The Attributes#to_hash is the one that makes get_item request.

from aws-sdk-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.