Closed corey-dawson closed 1 year ago
If you have a dictionary containing keyword arguments, the correct approach is as follows:
d = {"col1": 8, "col2": cx_Oracle.DATETIME}
cursor.setinputsizes(**d)
This is the way it would be done normally (static):
cursor.setinputsizes(col1=8, col2=cx_Oracle.DATETIME)
This is "normal" Python behavior for a method that has the following signature:
def setinputsizes(*args, **kwargs)
Am I missing something? I'm not sure exactly what the problem is!
@anthony-tuininga This is exactly what i was looking for! thanks for the quick response, i really appreciate it.
When using binding for an insert statement (binding the dataframe column to database table columns), there does not appear to be an obvious way of dynamically adding the inputsizes (curosr.setinputsizes()). The setinput sizes function doesnt seem to accept the standard python datatypes to do this, which would make it possible to do this in the case of binding by name. Please provide some input on how to do this or update the function to be able to pass a dictionary
Working
Desired
If columns are binded, and the setinputsizese is used with positional arguments (cursor.setinputsizes(8, cx_Oracle.DATETIME)), an exception is raised, "ProgrammingError: positional and named binds cannot be intermixed". Please provide a method of dynamically adding named inputsizes for binding by name method. If there is a way of already doing this, please provide an example. The documentation doesn't provide good clarity to this, so if there is a method, it would help to update the documentation.
sudo code for future state
Thanks in advance!