Hi,
Using postgres schemas, I am unable to drop an index that have just
been created.
The following example will produce a "sqlalchemy.exc.ProgrammingError:
(ProgrammingError) index "my_idx" does not exist":

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Index
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.types import Integer, String

Base = declarative_base()
Base.metadata.bind = "postgres://user:pass@localhost/sqla_test"
meta = Base.metadata
session = scoped_session(sessionmaker(bind=meta.bind))()


class Test(Base):
    __tablename__ = 'test'
    __table_args__ = {
            'schema': 'app'
            }
    id = Column(Integer, primary_key=True)
    name = Column(String(20))

meta.drop_all()
meta.create_all()

i = Index('my_idx', Test.__table__.c.name)
i.create()
i.drop()

After looking at the code, it looks like
`DDLCompiler.visit_drop_index` does not prefix the index name with the
schema.
So for my example, the sql produced is "DROP INDEX my_idx" instead of
"DROP INDEX app.my_idx".

Should I report this as a bug somewhere?
Thanks,
Bruno

-- 
Bruno Binet

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Mail : bruno.bi...@camptocamp.com
http://www.camptocamp.com

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to