Skip to content

Index.unique should be only True or False, index=True on Column breaking this #2825

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by Michael Bayer (@zzzeek)

>>> from sqlalchemy import Table, MetaData, Column, Integer
>>> t1 = Table('t', MetaData(), Column('x', Integer, index=True))
>>> list(t1.indexes)[0](0).unique
False



#!diff
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -1123,7 +1123,7 @@ class Column(SchemaItem, ColumnClause):
                     "To create indexes with a specific name, create an "
                     "explicit Index object external to the Table.")
             Index(_truncated_label('ix_%s' % self._label),
-                                    self, unique=self.unique)
+                                    self, unique=self.unique if self.unique is not None else False)
         elif self.unique:
             if isinstance(self.unique, util.string_types):
                 raise exc.ArgumentError(

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Oct 14, 2013

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

621c22c 0.8

78a3896 0.9

sqlalchemy-bot

sqlalchemy-bot commented on Oct 14, 2013

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
added
schemathings related to the DDL related objects like Table, Column, CreateIndex, etc.
bugSomething isn't working
on Nov 27, 2018
added this to the 0.8.xx milestone on Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghigh priorityschemathings related to the DDL related objects like Table, Column, CreateIndex, etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          Index.unique should be only True or False, index=True on Column breaking this · Issue #2825 · sqlalchemy/sqlalchemy