Unexpected result while calling informix procedure in python

Aman Agrawal

Unexpected result while calling informix procedure in python

I Have created a procedure named 'off_shift_timing'.

When I am executing below query from client it gives me expected result

query :- "execute procedure off_shift_timing('13c236ed-ebcf-11e8-8549-f6bfe15867a6')"

But when i am trying to execute the same procedure using function named callproc in ibm_db_dbi module it return parameter value not the expected result.

Sample code:-

connection class :

import ibm_db_dbi as db

class DatabaseInformix:

Informix_DATABASE = data["Informix_DATABASE"]
Informix_HOSTNAME = data["Informix_HOSTNAME"]
Informix_UID = data["Informix_UID"]
Informix_PWD = data["Informix_PWD"]
Informix_PORT = data["Informix_PORT"]


def __init__(self):
    try:
        self.connection = db.connect("DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;UID=%s;PWD=%s;" % (self.Informix_DATABASE,self.Informix_HOSTNAME, self.Informix_PORT, self.Informix_UID,self.Informix_PWD), "", "")
        self.cursor = self.connection.cursor()
    except db.Error as e:
        self.connection = ""
        logger.error('Informix Connection: %s', e._message)

def query1(self, procname, param1):
    if(self.connection != ""):
        try:
            return self.cursor.callproc(procname, param1)
        except db.Error as e:
            logger.error('DB001 error in query : %s', e._message)

Main class :-

obj1 = DatabaseInformix()

project_guid = '13c236ed-ebcf-11e8-8549-f6bfe15867a6'

results2 = obj1.query1('off_shift_timing', (project_guid,))

print(results2)

output :- ('13c236ed-ebcf-11e8-8549-f6bfe15867a6',)

but it is not actual output it is the variable in form of tuple