Exclude constraint where clause not rendered when __table__.tometadata() used
Given this model:
class MyModel(Base):
__tablename__ = 'my_model'
id = Column(Integer, primary_key=True)
period = Column(TSRANGE())
label = Column(String)
__table_args__ = [ExcludeConstraint(('period', '&&'), where='label is null')]
...I would expect the following constraint to be created:
EXCLUDE USING gist (period WITH &&) where (label is null)
...but instead I get:
EXCLUDE USING gist (period WITH &&)
Comments (10)
-
repo owner -
reporter <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>Which version of sqlalchemy were you using? I'll try the equivalent version here and see if I can reproduce.<br> </p> <br> <div class="moz-cite-prefix">On 27/01/2017 15:39, Michael Bayer wrote:<br> </div> <blockquote
-
repo owner I just tried with 1.0.17 and it works there also. I'm not seeing a past issue with this so far.
-
repo owner - changed status to closed
reopen if you can reproduce, thanks
-
reporter -
reporter - changed status to open
Script to reproduce:
from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.dialects.postgresql import TSRANGE, ExcludeConstraint Base = declarative_base() class MyModel(Base): __tablename__ = 'my_model' id = Column(Integer, primary_key=True) period = Column(TSRANGE()) label = Column(String) __table_args__ = ( ExcludeConstraint(('period', '&&'), where='label is null'), ) e = create_engine("postgresql://scott:tiger@localhost/test", echo=True) c = e.connect() t = c.begin() if __name__=='__main__': metadata2 = MetaData() MyModel.__table__.tometadata(metadata2) metadata2.create_all(c)
-
repo owner do you require 1.0.x backport ?
-
reporter Hope 1.1.x will "just work", so let's say no for now...
-
repo owner -
repo owner - changed status to resolved
Copy whereclause / using in ExcludeConstraint
Fixed bug in Postgresql :class:
.ExcludeConstraint
where the "whereclause" and "using" parameters would not be copied during an operation like :meth:.Table.tometadata
.Change-Id: I2f704981d4d4862f9c82a50272006fab8becebb6 Fixes:
#3900→ <<cset 1c578a710f14>>
- Log in to comment
cant reproduce:
output: