-
Notifications
You must be signed in to change notification settings - Fork 362
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
Need to know if binding to integers NATIVE_INT causes performance issue or other problem #208
Comments
I see that there is indeed a difference between cx_Oracle 5.3 and cx_Oracle 6.4 regarding the cursor.setinputsizes(x=cx_Oracle.NUMBER) behaviour. I'll look into why that would be and report back. In the meantime, just not calling setinputsizes() works as expected -- which I think you already know. You can also use cursor.setinputsizes(x=int) which is a better solution than using cursor.setinputsizes(x=cx_Oracle.NATIVE_INT). The reason is that Oracle has optimised use of the NUMBER type but the NATIVE_INT type has a slight performance drop -- and the use of "int" just tells cx_Oracle that only integers will be accepted, but the Oracle NUMBER type is still used. I hope that's clear! |
OK ill put "int" in there for now |
The reason for the difference between the two versions (5 and 6) is due to the adoption of ODPI-C and the simplification of the code in the cx_Oracle code base. In version 5, using cx_Oracle.NUMBER for a variable effectively used Oracle NUMBER and the cx_Oracle code would make OCI calls to transform integer, float and decimal values to Oracle NUMBER values. In version 6, using cx_Oracle.NUMBER for a variable effectively means double floating point and you can no longer mix and match floating point, integer and decimal values in a single variable. ODPI-C requires that this be specified when the variable is created and helps to eliminate uncertainty about how the data is represented (with the loss of a bit of flexibility). So the use of "int" in cursor.setinputsizes() for this case is exactly what you want. It should work just as effectively in cx_Oracle 5, too. |
yep have already released the workaround thanks! |
It seems that in cx_Oracle 6.x we now lose numeric precision for large integers if we bind to cx_Oracle.NUMBER, we now have to bind to cx_Oracle.NATIVE_INT, example below.
If I change SQLAlchemy to bind all integers to NATIVE_INT instead of NUMBER, what surprises are there? does this type perform very poorly or not function in all cases?
The text was updated successfully, but these errors were encountered: