Search code examples
pythonpython-3.xteradatateradatasql

Teradatasql Python: Unable to pass column name


I'm using the teradatasql python module and i'm unable to find in documentation on how to pass named parameters into the cursor.execute()

i have stored procedure which takes IN parameter , but in teradatasql i dont see option to pass column name. is there any way to do this?

here is some snippet of my PROC which takes IN parameters

(
        IN transId VARCHAR(50),
        IN name VARCHAR(50),
        IN  add VARCHAR(50),
        IN  zip VARCHAR(50),
        IN  area VARCHAR(50)
    )

code

with teradatasql.connect ('{"host":"whomooz","user":"guest","password":"please"}') as con:
    with con.cursor () as cur:
        cur_execute (cur, "{call examplestoredproc (?, ?)}", [10, 7]) # bound parameter values

def cur_execute (cur, sSQL, params=None):
    print ()
    print ("cur.execute", sSQL, "bound values", params)
    cur.execute (sSQL, params)

Solution

  • I'm using the teradatasql python module and i'm unable to find in documentation on how to pass named parameters into the cursor.execute()

    The Teradata Database does not support binding stored procedure argument values by name. Therefore, the teradatasql driver cannot support that either.

    You must specify question-mark parameter markers in your call to the stored procedure, and you must specify unnamed stored procedure argument values that are bound by position to the question-mark parameter markers.