Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upOracle.ProgrammingError: positional and named binds cannot be intermixed (==6.4) #199
Comments
This comment has been minimized.
This comment has been minimized.
Can you provide a test case that fails? Or provide instructions on getting the unit tests you are referencing up and running so I can see what is going on? Thanks! |
This comment has been minimized.
This comment has been minimized.
For sure, it happens in the Here is essentially our import sqlalchemy
import cx_Oracle
from sqlalchemy import Table, Column, MetaData, String
user = "SYSTEM"
password = "Oradoc_db1"
dsn = cx_Oracle.makedsn("127.0.0.1", <DOCKER_ASSIGNED_PORT>, "ORCLCDB",
service_name="ORCLPDB1.localdomain")
connection_str = f"oracle+cx_oracle://{user}:{password}@{dsn}"
engine = sqlalchemy.create_engine(connection_str)
md = MetaData(bind=engine)
schema_name = "sone"
table_name = "table1"
engine.execute(f"CREATE USER {schema_name} IDENTIFIED BY test")
engine.execute(f"ALTER USER {schema_name} QUOTA UNLIMITED ON USERS")
columns = []
for column in ('foo', 'bar', 'baz'):
columns.append(Column(column.upper(), String(50), nullable=True,
quote=False))
_ = Table(table_name, md, *columns, schema=schema_name, quote=False,
quote_schema=False)
md.create_all() |
This comment has been minimized.
This comment has been minimized.
Thanks for the test case. That was sufficient to track this issue down. Essentially a bug fix in cx_Oracle 6.4 inadvertently introduced this issue. Calling cursor.setinputsizes() with no parameters at all would make the assumption that you were binding by position, so a subsequent call to cursor.execute() with named arguments would immediately raise this issue. Although it makes no sense to call cursor.setinputsizes() with no parameters, it also shouldn't cause any problems! I'll get this corrected. |
anthony-tuininga
added
the
bug
label
Jul 3, 2018
added a commit
that referenced
this issue
Jul 3, 2018
This comment has been minimized.
This comment has been minimized.
I have corrected this issue and added a test case that should prevent this issue from happening in the future. I'll wait a while before releasing cx_Oracle 6.4.1, just to ensure there aren't any other issues. Thanks again for reporting this issue. |
anthony-tuininga
closed this
Jul 3, 2018
This comment has been minimized.
This comment has been minimized.
Awesome, thanks! No problem on holding out a hot fix, as we’ll just keep an eye out and unpin the version at that time! |
This comment has been minimized.
This comment has been minimized.
Re-opening as requested. Will close again once 6.4.1 has been released. |
anthony-tuininga
reopened this
Jul 4, 2018
This comment has been minimized.
This comment has been minimized.
zzzeek
commented
Jul 5, 2018
yep...i'm getting this too :) can you refer to the patch, and/or did you add tests for this? |
This comment has been minimized.
This comment has been minimized.
zzzeek
commented
Jul 5, 2018
oh sorry i see it above |
added a commit
to zzzeek/alembic
that referenced
this issue
Jul 5, 2018
added a commit
to zzzeek/sqlalchemy
that referenced
this issue
Jul 5, 2018
added a commit
to zzzeek/sqlalchemy
that referenced
this issue
Jul 5, 2018
This comment has been minimized.
This comment has been minimized.
vinayinfo
commented
Jul 6, 2018
I am getting the Same error. to fix that I have downgraded to v6.3.1 |
This comment has been minimized.
This comment has been minimized.
pgacv2
commented
Jul 6, 2018
Confirmed, downgrading to 6.3.1 avoids that error. |
This comment has been minimized.
This comment has been minimized.
mkai
commented
Jul 9, 2018
I have the same problem – I think it affects everyone using SQLAlchemy. Waiting to upgrade until 6.4.1 is released. |
This comment has been minimized.
This comment has been minimized.
cx_Oracle 6.4.1 has been released with this issue corrected in it. |
anthony-tuininga
closed this
Jul 9, 2018
This comment has been minimized.
This comment has been minimized.
felixxm
commented
Jul 11, 2018
Many thanks Anthony |
This comment has been minimized.
This comment has been minimized.
mPyth
commented
Aug 15, 2018
•
hi, Query is quite long, so I put it at the post end.
Below is a query. Please give me further instructions which are needed for bug catching (for example a kind of multi-step query bisection, to remove all comments, ...). |
This comment has been minimized.
This comment has been minimized.
Not sure what you are asking exactly. The issue on which you are commenting was corrected in cx_Oracle 6.4.1. If you have a new issue, please open a new issue and carefully explain what you are asking. Thanks. |
This comment has been minimized.
This comment has been minimized.
mPyth
commented
Aug 17, 2018
Ok, thx for prompt answer. |
mPyth
referenced this issue
Aug 17, 2018
Closed
ProgrammingError: positional and named binds cannot be intermixed (cx-Oracle==6.4.1) #216
This comment has been minimized.
This comment has been minimized.
hmkaraca
commented
Dec 26, 2018
We have the same with version cx_oracle 7.0 which we didn' t have with version 6.4. Can you please check and advice? |
This comment has been minimized.
This comment has been minimized.
@hmkaraca please give a (runnable) python script and sql to create any data. Thanks. |
This comment has been minimized.
This comment has been minimized.
hmkaraca
commented
Dec 27, 2018
Please find document attached. Code works with version 6.2.1 properly, whereas it fails with above error with 7.0. Thanks. |
This comment has been minimized.
This comment has been minimized.
hmkaraca
commented
Dec 30, 2018
Is there any update on this? |
This comment has been minimized.
This comment has been minimized.
@hmkaraca please simplify your scripts to a minimal test case with logical code and as few external dependencies as possible. Make sure all necessary SQL is provided (what is LS_ANR_3G_OPTIMIZER_SETTINGS?) |
This comment has been minimized.
This comment has been minimized.
hmkaraca
commented
Dec 31, 2018
code.zip |
This comment has been minimized.
This comment has been minimized.
hmkaraca
commented
Jan 6, 2019
Is this information enough to check? |
This comment has been minimized.
This comment has been minimized.
How do we run it, where do we set the password, does it need all those imports, what's the different between the two files? I could spend time on it, or I could be on vacation :) Here's an example of a simple testcase: #250 |
This comment has been minimized.
This comment has been minimized.
hmkaraca
commented
Jan 7, 2019
Sorry, I converted it to a single file as attached. You can run just as python test_db_con.py. Thanks. |
This comment has been minimized.
This comment has been minimized.
Ok. That does indeed replicate the issue. The problem is that you are calling cursor.setinputsizes() with an empty dictionary and the code looks for the presence of at least one keyword argument before considering the method to be "bind by name". So the code is assuming that you are binding by position since you didn't actually provide any keyword arguments. There isn't much point in calling setinputsizes() in this case...although I will grant you that the error message is a bit confusing! As an aside, you aren't actually using bind variables at all but simply doing a search/replace. What you should have instead is something like this: cursor.execute("select :execution_guid from dual",
execution_guid="B3B6A70F330CA04CA1609D7AC8FD1FC0") That's far simpler! You should only use setinputsizes() if you need to deviate from the default bind types. |
This comment has been minimized.
This comment has been minimized.
hmkaraca
commented
Jan 7, 2019
Actually, this was the simplest case to reproduce the problem, however, even if I use setinputsizes without empty dictionary, we have the same problem, that' s why I submitted this. I don' t have the problem with same code using version cx_oracle 6.2.1 |
added a commit
that referenced
this issue
Jan 8, 2019
This comment has been minimized.
This comment has been minimized.
I corrected the issue with calling cursor.setinputsizes() with an empty dict. If you are having problems in other situations, please provide a new test case -- and open a new issue! Thanks. |
jakereps commentedJul 3, 2018
•
edited
Discovered in unit testing due to no version pinning in the project's Pipfile. Locally (
6.3.1
) remains functional, while all database set up tasks fail in our CI pipeline oncx_Oracle==6.4
.Binding errors stating that positional and named binds cannot be intermixed when there are no positional binds being used.
Answer the following questions:
Locally:
$ python -c 'import cx_Oracle; print(cx_Oracle.__version__)' 6.3.1
Remote (issue causing)
$ python -c 'import cx_Oracle; print(cx_Oracle.__version__)' 6.4
installed? Where is it installed?
$ uname -a Darwin Jordens-MacBook-Pro.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64 $ system_profiler SPSoftwareDataType Software: System Software Overview: System Version: macOS 10.13.5 (17F77) Kernel Version: Darwin 17.6.0 Boot Volume: Macintosh HD Boot Mode: Normal Computer Name: Jorden’s MacBook Pro User Name: Jorden Kreps (jordenkreps) Secure Virtual Memory: Enabled System Integrity Protection: Enabled Time since boot: 6 days 1:57
gcc --version
.N/A
install with)? Who were you logged in as?
6.3.1
6.4
Pinning to 6.3.1 resolves the issue.