-1

I really need that. I've tried to define it in my model:

vs_id = Column(Integer, primary_key=True, unique=False)

But it didn't work - database schema has such row:

ALTER TABLE ONLY my_table__ ADD CONSTRAINT my_table___pkey PRIMARY KEY (vs_id);

How to solve this? Thanks in advance!

2
  • Primary key is by definition something that uniquely identifies rows. Commented Mar 10, 2012 at 18:23
  • 1
    And if you're trying to make it a primary key for the purpose of fast lookups consider using an index instead. Commented Mar 10, 2012 at 19:39

1 Answer 1

3

The primary key MUST be unique, in order to be able to refer to a specific record.

If you need this, add another field that isn't unique!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.