from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import UniqueConstraint

Base = declarative_base()

class Store(Base):
    __tablename__ = 'store'
    id = Column(Integer, primary_key=True, autoincrement=True)
    key = Column(String)
    tag = Column(String)
    value = Column(String)
    __table_args__ = (UniqueConstraint('key', 'tag'),)

    def __unicode__(self):
        return unicode(key)

from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import PrimaryKeyConstraint

Base = declarative_base()

class Store(Base):
    __tablename__ = 'store'
    key = Column(String)
    tag = Column(String)
    value = Column(String)
    __table_args__ = (PrimaryKeyConstraint('key', 'tag'),)

    def __unicode__(self):
        return unicode(key)

Make tag and key be a composite primary key
Make tag and key be a composite primary key

  from sqlalchemy import Column, Integer, String
  from sqlalchemy.ext.declarative import declarative_base
- from sqlalchemy.schema import UniqueConstraint
+ from sqlalchemy.schema import PrimaryKeyConstraint
  
  Base = declarative_base()
  
  class Store(Base):
      __tablename__ = 'store'
-     id = Column(Integer, primary_key=True, autoincrement=True)
      key = Column(String)
      tag = Column(String)
      value = Column(String)
-     __table_args__ = (UniqueConstraint('key', 'tag'),)
+     __table_args__ = (PrimaryKeyConstraint('key', 'tag'),)
  
      def __unicode__(self):
          return unicode(key)
  
Make tag and key be a composite primary key
## Code Before:
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import UniqueConstraint

Base = declarative_base()

class Store(Base):
    __tablename__ = 'store'
    id = Column(Integer, primary_key=True, autoincrement=True)
    key = Column(String)
    tag = Column(String)
    value = Column(String)
    __table_args__ = (UniqueConstraint('key', 'tag'),)

    def __unicode__(self):
        return unicode(key)

## Instruction:
Make tag and key be a composite primary key
## Code After:
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import PrimaryKeyConstraint

Base = declarative_base()

class Store(Base):
    __tablename__ = 'store'
    key = Column(String)
    tag = Column(String)
    value = Column(String)
    __table_args__ = (PrimaryKeyConstraint('key', 'tag'),)

    def __unicode__(self):
        return unicode(key)
