GithubHelp home page GithubHelp logo

net-amazon-dynamodb's Introduction

NAME

Net::Amazon::DynamoDB - Simple interface for Amazon DynamoDB

DESCRIPTION

Simple to use interface for Amazon DynamoDB

If you want an ORM-like interface with real objects to work with, this is implementation is not for you. If you just want to access DynamoDB in a simple/quick manner - you are welcome.

See https://github.com/ukautz/Net-Amazon-DynamoDB for latest release.

SYNOPSIS

my $ddb = Net::Amazon::DynamoDB->new(
    access_key => $my_access_key,
    secret_key => $my_secret_key,
    tables     => {
        
        # table with only hash key
        sometable => {
            hash_key   => 'id',
            attributes => {
                id   => 'N',
                name => 'S'
            }
        },
        
        # table with hash and reange key key
        othertable => {
            hash_key   => 'id',
            range_key  => 'range_id',
            attributes => {
                id       => 'N',
                range_id => 'N',
                attrib1  => 'S',
                attrib2  => 'S'
            }
        }
    }
);

# create both tables with 10 read and 5 write unites
$ddb->exists_table( $_ ) || $ddb->create_table( $_, 10, 5 )
    for qw/ sometable othertable /;

# insert something into tables
$ddb->put_item( sometable => {
    id   => 5,
    name => 'bla'
} ) or die $ddb->error;
$ddb->put_item( sometable => {
    id        => 5,
    range_key => 7,
    attrib1   => 'It is now '. localtime(),
    attrib1   => 'Or in unix timstamp '. time(),
} ) or die $ddb->error;

net-amazon-dynamodb's People

Contributors

bikesandbbq avatar briandfoy avatar fayland avatar hernan604 avatar jpepersack avatar jvanvleet avatar midendian avatar saltyduck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

net-amazon-dynamodb's Issues

credentials returning as undef in return sub

Can't use an undefined value as a HASH reference at /usr/lib/perl5/site_perl/5.14.2/Net/Amazon/DynamoDB.pm line 1544.

$self->_credentials->{ SecretAccessKey }

is returning as undef ...

N for range search

Hello.

is there any reason that you have

$value = $item_ref->{ $key } .'';

in line 720. the . '' seems quite weird for me when the key is N.

for example, I set table as

{"Table":{"CreationDateTime":1.350285647082E9,"ItemCount":0,"KeySchema":{"HashKeyElement":{"AttributeName":"id","AttributeType":"S"},"RangeKeyElement":{"AttributeName":"version","AttributeType":"N"}},"ProvisionedThroughput":{"ReadCapacityUnits":10,"WriteCapacityUnits":5},"TableName":"test_picture","TableSizeBytes":0,"TableStatus":"ACTIVE"}}

then put_item I set

{"Item":{"keywords":{"S":"Perl\nDynamoDB"},"filename":{"S":"1.jpg"},"date":{"N":"1350287320"},"version":{"N":"1"},"id":{"S":"MPCBvJwW4hGSd_kERh+kNg"},"tbuser":{"N":"999"}},"TableName":"test_picture"}

see, you have version converted into "1" here. actually I set version=1 in Perl.

and it will be broken for

get_item('test_picture', { id => $id, version => 1})

{"TableName":"test_picture","ConsistentRead":false,"Key":{"RangeKeyElement":{"N":1},"HashKeyElement":{"S":"MPCBvJwW4hGSd_kERh+kNg"}}}

it returns error
'_content' => '{"__type":"com.amazon.coral.service#SerializationException","Message":"class java.lang.Short can not be converted to an String"}',

but if I query with

get_item('test_picture', { id => $id, version => "1"})

it works:

{"TableName":"test_picture","ConsistentRead":false,"Key":{"RangeKeyElement":{"N":"1"},"HashKeyElement":{"S":"BO+oGaAW4hGmv4ycE82ppw"}}}

I just do not understand why we have . ''; when put_item?

any idea?

Thanks

Token Key Expired

i got a small bug, while i connected my site to DynamoDB , token is key is expired after the token time is out .. but programme is grabs the token id into ram.Getting the same error after every time after the token expired

Token is alive for one hour, it would be resource consuming to get token for every request.

i got a small request that if u could get the implement that in the request token after it expired which can be done at
line 1595 #handle errror in module
i could have pulled through GIT but not to able to find the error API of the STS
That would be a better option , atleast could u pass the code for me
Thank You
Anwesh

Use something other than Cache

This is a pretty old module that requires DB_File which requires Berkeley DB 1.x. I can't get that to compile in some places.

Parameter for _security_token_url ?

Hi,

Is possible pass _security_token_url as parameter or some another way ?

Today is fixed:

has _security_token_url => ( isa => 'Str', is => 'rw', default => 'https://sts.amazonaws.com/?Action=GetSessionToken&Version=2011-06-15' );

But when you create on endpoint (for private VPCs) we need use : "sts.us-east-1.amazonaws.com" not "sts.amazonaws.com"

I copy module and replace that and works fine with :

has _security_token_url => ( isa => 'Str', is => 'rw', default => 'https://sts.us-east-1.amazonaws.com/?Action=GetSessionToken&Version=2011-06-15' );

Best Regards

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.