Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7999573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:32:39+00:00 2026-06-04T15:32:39+00:00

I have got an python application which runs on version 2.7 using postgres 9.1

  • 0

I have got an python application which runs on version 2.7 using postgres 9.1 with sqlalchemy 0.7 i believe.

I have a wx python gui from which i add and delete items.The code was working fine but now after making some modifications i recieve

$self.session.commit()
$  File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 645, in commit
$  File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 313, in commit
$  File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 297, in _prepare_impl
$  File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 1547, in flush
$  File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 1616, in _flush
$  File "build\bdist.win32\egg\sqlalchemy\orm\unitofwork.py", line 328, in execute
$  File "build\bdist.win32\egg\sqlalchemy\orm\unitofwork.py", line 472, in execute
$  File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 2291, in _save_obj
$  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1405, in execute
$ File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1538, in           
$ _execute_clauseelement
$  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1646, in     
$_execute_context
$  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1639, in 
$_execute_context
$  File "build\bdist.win32\egg\sqlalchemy\engine\default.py", line 330, in do_execute
$sqlalchemy.exc.IntegrityError: (IntegrityError) duplicate key value violates
$ unique constraint "Equipment_pkey"
$DETAIL:  Key (id)=(4) already exists.
$ 'INSERT INTO "Equipment" (name, "numPorts") VALUES (%(name)s, %(numPorts)s)     
$RETURNING "HWCIs".id' {'numPorts': 0, 'name': u'jkhj'}

Now when i restart the application the key id increases by one.I can clearly see that something is resetting the id sequence of the database. Could anypne please help on how i can fix this issue by writing python code or what is the easiet step to overcome this issue . I tried working through psql commands but i was unsuccessful due to my lack of knowledge.If solution can explained in easy steps that would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:32:41+00:00Added an answer on June 4, 2026 at 3:32 pm

    Well I found the answer. I was conencting to another database connection which caused the database sequence to reset to 1. So when application starts it seeks to position 1. So I just needed to change the sequence to last no. It worked!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a Python/Django application which runs quite a lot of SQL statements. For
Using stomp.py (3.0.5) with python (2.6) alongside Apache ActiveMQ (5.5.1). I have got the
I have a bytearray object in Python 2.7 that I got from a query
I have got method which is using Assembly.LoadFrom(...) statement and returns the supported cultures
I'm currently using an application in python which works quite well but when I'm
I have a small Python web application using the Cherrypy framework. I am by
I have an application written in Python. It collects and parses data from certain
I have an application(developed in python) that requires a refreshed view from the datastore
I have got a Wavecom Supreme GSM modem. I wrote a simple application that
I have got an ActiveX Control that gets an image from a fingerprint device

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.