python-2.7clientdecimalvoltdb

VoltProcedure.call()--TypeError: an interger is required for Python2.7 Decimal datatype


Here is my code:

from voltdbclient import *
from decimal import *

client = FastSerializer("s7biapp26", 21212)
proc = VoltProcedure(client, "test2_insert", [FastSerializer.VOLTTYPE_DECIMAL])
proc.call([Decimal(129)])
client.close()

This code can run successfully with Python3.X, but reports

TypeError: an integer is required

with Python2.7, just for the decimal datatype. How can I avoid this error?

enter image description here


Solution

  • I was able to reproduce this issue and I've logged a bug. I'm not sure if there's an easy fix, but if you need to use python 2.7 one option is you could use the older version of the python driver that is provided in the main VoltDB/voltdb project on Github. That version actually works with python 2.6 or later, but does not support python 3. You can find it here:

    https://github.com/VoltDB/voltdb/blob/master/lib/python/voltdbclient.py

    This version of the driver is used by some of the VoltDB command-line utilities and is versioned and tested along with the database.

    Disclaimer: I work at VoltDB