-
Notifications
You must be signed in to change notification settings - Fork 567
Closed
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Milestone
Description
How should Datastore's Entity behave when accessing properties that have not yet been set?
entity = Gcloud::Datastore::Entity.new
entity["name"] = "John Jacob Jingleheimer Schmidt"
puts entity["name"] #=> John Jacob Jingleheimer Schmidt
puts entity["email"] #=> ???The current behavior is to return nil. Another option is to raise an error.
IMO the behavior should be permissive. Consider the case of a projection query where entity records stored in Datastore have both name and email, but only name is projected in the query. In ActiveRecord the attributes that are not selected are set to nil.
query = Gcloud::Datastore::Query.new.kind("User").select("name")
entities = Gcloud::Datastore.connection.run query
entities.each do |entity|
puts entity["email"]
endThoughts?
Metadata
Metadata
Assignees
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.