Владислав Белогрудов <vlad.belogru...@gmail.com> wrote:

> Hi everyone,  
> 
> I am testing sqlalchemy-migrate coupled with sclalchemy. My table has 
> constraint with uppercase name like FK_1_1 .

on Oracle, SQLAlchemy folds UPPERCASE names to lower case, as Oracle’s 
UPPERCASE is in fact the case-insensitive representation.   If you specify a 
name as UPPERCASE, that indicates its the quoted name in UPPERCASE, which is 
not what you want; your name isn’t actually in uppercase unless it was created 
that way with explicit quoting.

> Alchemy-migrate sees the name and thinks it should be in ticks :) then it 
> passes the "ticked" name to sqlalchemy and the latter again sees that fk 
> needs to be quoted .. at the end sql fails because the name becomes 
> ```FK_1_1```

SQLAlchemy-migrate is no longer maintained except to keep it running on 
Openstack.  Alembic is recommended.  However in Alembic’s case, and possibly 
SQLA-migrate’s as well, SQLAlchemy is not applying UPPERCASE folding to 
reflected constraint names as of yet: see 
https://bitbucket.org/zzzeek/sqlalchemy/issue/3276/normalize-name-for-oracle-constraint-index.
  So a migration that is generated from reflection:

        migration_lib.drop_foreign_key(“FK_1_1”)

needs to be changed manually:

        migration_lib.drop_foreign_key(“fk_1_1”)

However, as far as the name having ticks in it, I don’t know what that’s about, 
sounds like something Migrate is doing incorrectly.   SQLAlchemy and Alembic 
have no code involving ticks except in the MySQL dialect.

> 
> Shouldn't sqlalchemy/sql/compiler.py check if a name already is in ticks 
> before quoting it again?

There is no need for compiler.py to perform such a check.  Names should never 
have quotes actually inside of the string value itself.







-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to