Skip to content

Commit

Permalink
Updated for compatibility with DataMapper 0.10.*
Browse files Browse the repository at this point in the history
 * This release breaks backwards compatibility!
 * Can specify most setup fields in URI form, e.g.:
   simpledb://ACCESS_KEY:SECRET_KEY@sdb.amazon.com/DOMAIN
 * ALL datamapper query conditions are now supported. Conditions which are
   not natively supported by SimpleDB are performed by the adapter on the
   result set.
 * Serial properties are now supported using UUIDs.
 * Eliminated newline substitution workaround in strings and fixed the
   underlying problem.
 * Added a new compliance_spec using the official DataMapper shared spec. The
   adapter passes all compliance specs.
 * Rewrote query translation. More operators are supported natively.
 * Only loads needed fields now instead of always getting all fields
 * Updated SdbArray to work with DataMapper 0.10.0
 * Null values are now represented by removing attributes instead of by a
   special string. This is more in line with how SimpleDB defines NULL.
   As a result, "IS NOT NULL" now works as expected.
 * Added "consistency policies" to aid in testing. "manual" policy enables
   test code to call adapter.wait_for_consistency. "automatic" policy attempts
   to wait for consistency before reads. Consistency checking is done using
   "consistency tokens" written to a special SimpleDB object.
 * Tests now blow away testing domain and re-create it, for better isolation.
 * Test domain is now configurable (and MUST be configured before tests will
   run).
 * Switched many tests to only do their setup once per example group, for speed.
  • Loading branch information
Avdi Grimm committed Nov 15, 2009
1 parent 61b9905 commit 27726e2
Show file tree
Hide file tree
Showing 14 changed files with 466 additions and 226 deletions.
55 changes: 39 additions & 16 deletions README
Expand Up @@ -3,17 +3,28 @@
This has been moved to a new location:
http://github.com/devver/dm-adapter-simpledb/tree/master

This is the new version of the adapter now based on Right_Aws which has helped a lot with performance. The rest of this FAQ is a bit dated...
This is the new version of the adapter now based on Right_Aws which has helped a
lot with performance. The rest of this FAQ is a bit dated...

Written by Jeremy Boles
Contributers Edward Ocampo-Gooding (edward), Dan Mayer (danmayer), Thomas Olausson (latompa)

Contributers:
Edward Ocampo-Gooding (edward)
Dan Mayer (danmayer)
Thomas Olausson (latompa)
Avdi Grimm (avdi)

A DataMapper adapter for SimpleDB.

This version combines elements of Jeremy's orginal project, adding in code from Edward Ocampo-Gooding. It also includes various bug fixes and updates from Dan Mayer.
This version combines elements of Jeremy's orginal project, adding in code from
Edward Ocampo-Gooding. It also includes various bug fixes and updates from Dan
Mayer. Avdi Grimm updated the code to work with DataMapper 0.10.*, along with
misc. other improvements.

Tested using Matthew Painter’s SimpleDB/dev http://code.google.com/p/simpledb-dev/
Additional SimpleDB/dev setup notes found here: http://pandastream.tumblr.com/post/52779609/playing-with-panda-without-simpledb-account
Tested using Matthew Painter’s SimpleDB/dev
http://code.google.com/p/simpledb-dev/ Additional SimpleDB/dev setup notes found
here:
http://pandastream.tumblr.com/post/52779609/playing-with-panda-without-simpledb-account

== Current state

Expand All @@ -35,7 +46,7 @@ Additional SimpleDB/dev setup notes found here: http://pandastream.tumblr.com/po
require 'rubygems'
require 'dm-core'

DataMapper.setup(:default, 'simpledb://sdb.amazon.com/sweetapp_development', :access_key_id => 'a valid access key id', :secret_access_key => 'a valid secret access key id')
DataMapper.setup(:default, 'simpledb://ACCESS_KEY:SECRET_KEY@sdb.amazon.com/DOMAIN')

[Same as the following, but skip the database.yml]

Expand All @@ -47,13 +58,11 @@ Additional SimpleDB/dev setup notes found here: http://pandastream.tumblr.com/po

adapter: simpledb
database: 'default'
access_key_id: (a 20-character, alphanumeric sequence)
secret_access_key: (a 40-character sequence)
domain: 'sweetapp_development'
access_key: (a 20-character, alphanumeric sequence)
secret_key: (a 40-character sequence)
domain: 'my_amazon_sdb_domain'
base_url: 'http://sdb.amazon.com'

Alternatively,

Create a model

class Tree
Expand All @@ -78,13 +87,27 @@ Additional SimpleDB/dev setup notes found here: http://pandastream.tumblr.com/po
yanked_tree = Tree.remote(:name => "Acer rubrum")

== Running the tests
add these two lines to your .bash_profile as the spec_helper relies on them
export AMAZON_ACCESS_KEY_ID='YOUR_ACCESS_KEY'
export AMAZON_SECRET_ACCESS_KEY='YOUR_SECRET_ACCESS_KEY'
Add these two lines to your .bash_profile as the spec_helper relies on them

$ export AMAZON_ACCESS_KEY_ID='YOUR_ACCESS_KEY'
$ export AMAZON_SECRET_ACCESS_KEY='YOUR_SECRET_ACCESS_KEY'

Configure the domain to use for integration tests. THIS DOMAIN WILL BE
DELETED AND RECREATED BY THE TESTS, so do not choose a domain which contains
data you care about. Configure the domain by creating a file named
THROW_AWAY_SDB_DOMAIN in the projet root:

$ echo dm_simpledb_adapter_test > THROW_AWAY_SDB_DOMAIN

Run the tests:

Create the test domain on SimpleDB, :domain => 'missionaries' as found in spec_helper. This can be done easiest via IRB or I went to a project that had a database.yml and called db:automigrate because of the added migration support to this adaprter.
rake spec

rake spec
NOTE: While every attempt has been made to make the tests robust, Amazon
SimpleDB is by it's nature an unreliable service. Sometimes it can take a
very long time for updates to be reflected by queries, and sometimes calls
just time out. If the tests fail, try them again a few times before reporting
it as a bug. Also try running the spec files individually.

== Bibliography
Relating to Amazon SimpleDB http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1292&ref=featured
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -54,7 +54,7 @@ def setup_dm(access_key, secret_key)
:adapter => 'simpledb',
:access_key => access_key,
:secret_key => secret_key,
:domain => 'missionaries'
:domain => 'dm_simpledb_adapter_test'
})
end

Expand Down

0 comments on commit 27726e2

Please sign in to comment.