Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: an integer is required in batch_mutate #28

Closed
dizpers opened this issue Mar 5, 2012 · 2 comments
Closed

TypeError: an integer is required in batch_mutate #28

dizpers opened this issue Mar 5, 2012 · 2 comments

Comments

@dizpers
Copy link

dizpers commented Mar 5, 2012

Hi! I use the following function to create a new user:

def createUser(self, identity, email, fname, lname, mname):
    cols = [
        Column(name="email", value=email, timestamp=datetime.datetime.now()),
        Column(name="fname", value=fname, timestamp=datetime.datetime.now()),
        Column(name="lname", value=lname, timestamp=datetime.datetime.now()),
        Column(name="mname", value=mname, timestamp=datetime.datetime.now())
    ]
    return self.db.batch_mutate(mutationmap={identity: {"users": cols}})

But after calling it I have an error. Stack trace:

Traceback (most recent call last):
File "server.py", line 100, in handle_request
res = yield self.backend.createUser(identity, email, fname, lname, mname)
File "/usr/local/lib/python2.7/site-packages/Twisted-11.1.0-py2.7-freebsd-8.2-STABLE-amd64.egg/twisted/internet/defer.py", line 545, in _runCallbacks
current.result = callback(current.result, _args, *_kw)
File "build/bdist.freebsd-8.2-STABLE-amd64/egg/telephus/pool.py", line 301, in
d.addCallback(lambda _: method(*req.args))
File "build/bdist.freebsd-8.2-STABLE-amd64/egg/telephus/cassandra/Cassandra.py", line 823, in batch_mutate
self.send_batch_mutate(mutation_map, consistency_level)
File "build/bdist.freebsd-8.2-STABLE-amd64/egg/telephus/cassandra/Cassandra.py", line 832, in send_batch_mutate
args.write(oprot)
File "build/bdist.freebsd-8.2-STABLE-amd64/egg/telephus/cassandra/Cassandra.py", line 4423, in write
oprot.trans.write(fastbinary.encode_binary(self, (self.class, self.thrift_spec)))
TypeError: an integer is required

What can cause the problem?

@dizpers
Copy link
Author

dizpers commented Mar 6, 2012

Problem solved, I should set timestamp like this:

int(time.time() * 1000000)

@dizpers dizpers closed this as completed Mar 6, 2012
@thepaul
Copy link
Collaborator

thepaul commented Mar 7, 2012

Can you not just leave the timestamp null if you want the current time inserted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants