No commit activity in last 3 years
No release in over 3 years
Adapter created to use the Windows Azure Table Services leveraging the simplicity of DataMapper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0.0
 Project Readme

Windows Azure Tables adapter for DataMapper

This ruby gem will allow you to interact with the Windows Azure Table Service API taking advantage of the DataMapper simplicity.

This adapter leverages the gem created by Johnny Halife in which I contribute with Table services and some improvements on the core service.

You will find more information about this gem on (waz-storage.heroku.com)

Note: This gem is being developed, If you want to contribute you can fork this repo or giving feedback by email to juanpablogarcia@gmail.com

Gem Dependencies

Getting started

sudo gem install dm-waztables-adapter --source http://gemcutter.org

Usage

require 'dm-waztables-adapter'

# set up a DataMapper with your Windwows Azure account 
DataMapper.setup(:default, { :adapter => 'WAZTables', :account_name => 'name', :access_key => 'your_access_key' })

# define a new model
class Guitarist
	include DataMapper::Resource

	property :id, String, :key => true
	property :name, String
	property :age, Integer
end

# set up database table on Windows Azure for a specific model
Guitarist.auto_migrate! # (destructive)
Guitarist.auto_upgrade! # (safe)

# set up database table on Windows Azure for all defined models
Datamapper.auto_migrate! # (destructive)
Datamapper.auto_upgrade! # (safe)

# play with DataMapper as usual
Guitarist.create(:id => '1', :name => 'Ritchie Blackmore', :age => 65)

yngwie = Guitarist.new(:id => '2', :name => 'Yngwio Malmsteen', :age => 46)
yngwie.name = "Yngwie Malmsteen"
yngwie.save

# retrieving a unique record by its id
ritchie = Guitarist.get('1')
ritchie.age # => 65

# updating records
ritchie.age = 66
ritchie.save

# retrieving all guitarists
	Guitarist.all.length # => 2

# performing queries
	older_guitar_players = Guitarist.all( { :age.gte => 50 } )

# deleting records
older_guitar_players.destroy!

TODO

  • Allow users to define the model partition key by using :partition_key => true option on the property.
  • Allow users to set the partition key as an additional attribute of the model with a lambda as default value.
  • Allow users to set the partition key as a method on the model.
  • Implement “in” operator in queries
  • Implement “order” query option
  • Retrieve more than 1000 fields using Windows Azure :continuation_token

Known Issues

  • Like statements are not working since Microsoft service API is throwing a NotImplemented exception when using startswith and endswith filters (more information here)
  • There’s no way to tell thru the entity which is the partition key of our entity, so there’s no out-of-the-box load balancing support (for mor info on the tables model that a look at http://msdn.microsoft.com/en-us/library/dd179338.aspx)