qizhiyi / sqlalchemy-migrate

Automatically exported from code.google.com/p/sqlalchemy-migrate
MIT License
0 stars 0 forks source link

Incorrect identifier casing/quoting on Oracle #85

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a database on Oracle with default cased identifiers. Say, "create
table documents;"
2. Create a script to add a column to the table. Use sqlalchemy default
casing (all lower case, see
http://www.sqlalchemy.org/docs/reference/dialects/oracle.html#identifier-casing
for detail). The script might look like the one attached.
3. Run the script on the unmigrated database.

What is the expected output? What do you see instead?
It should run, as sqlalchemy handles the Oracle default UPPERCASE of
identifiers. Normal sqlalchemy operations do work. However, trying to run
this script reports the error:
    sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-00942: table or view
does not exist
     '\nALTER TABLE "documents" ADD category VARCHAR(256)' {}

Something has quoted the name "documents", thus indicating to oracle that
this table name is lower-case and not the default upper case. In other
words, it appears as if sqlalchemy-migrate is not following the same
convention for quoting identifiers as sqlalchemy.

What version of the product are you using? On what operating system?
Windows 7 Pro 32-bit, Python 2.6.4, Sqlalchemy 0.5.6, sqlalchemy-migrate
0.5.4, cxOracle

Original issue reported on code.google.com by jaraco%jaraco.com@gtempaccount.com on 28 Mar 2010 at 12:14

Attachments:

GoogleCodeExporter commented 8 years ago
Interesting. I notice now that the documentation for the oracle identifier 
casing
doesn't appear in the 0.5 docs, so perhaps this problem goes away with 
sqlalchemy 0.6.

Original comment by jaraco%jaraco.com@gtempaccount.com on 28 Mar 2010 at 12:20

GoogleCodeExporter commented 8 years ago
It appears that sqlalchemy-migrate doesn't work with sqlalchemy-0.6. Any 
suggestions
on getting the above migration to work under Oracle? I presume I could 
reference the
table name as Table('DOCUMENTS'), but this would break the definition in all 
other
DBMSs, so isn't an option in our real-world definition.

Original comment by jaraco%jaraco.com@gtempaccount.com on 28 Mar 2010 at 12:27

GoogleCodeExporter commented 8 years ago
Indeed, migrate does not handle special case-sensitivity for oracle. SQLAlchemy 
0.6 
support is planned.

Original comment by iElect...@gmail.com on 20 Apr 2010 at 7:51

GoogleCodeExporter commented 8 years ago
SQLAlchemy 0.6.x and 0.7.x is supported now. I would appreciate feedback for 
this issue from a Oracle user with a current SQLAlchemy and sqlalchemy-migrate 
version.

Original comment by jan.ditt...@gmail.com on 28 Oct 2011 at 9:08