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 8521205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:45:18+00:00 2026-06-11T06:45:18+00:00

I am having trouble to execute following code, obviously these statement are part of

  • 0

I am having trouble to execute following code, obviously these statement are part of the code.

cursor.execute("select max(propernoun_SRNO) from tblauto_tagged")

starting_index = cursor.fetchone()[0]

if starting_index  == None :

    starting_index = 1

ending_index = int(starting_index) +len(s)

i = 0

for j in range(starting_index,ending_index):
    for i in range(0,len(s)):
        c.append(nnp_array_index_coloumn.count(i))
        add1 = add1 + c[i-1]
        add2 = add1 + c[i]
        cursor.execute("INSERT INTO tblauto_tagged(propernoun_SRNO,tagger,train,propernoun,propernoun_ID) VALUES (?,?,?,?,?)",(j,str(iput),str(corpora),str(nnp_array[add1:add2]),0))
        for item in nnp_array_index_coloumn:
            if item not in uniques:
                uniques.append(item)
                add1=0;add2=0

Error generated is

IntegrityError: ('23000', "[23000] [MySQL][ODBC 5.1 Driver][mysqld-5.1.61-community]Duplicate entry '1' for key 'PRIMARY' (1062) (SQLExecDirectW)")

I read previous attempts by different user to to solve the problem but for me nothing worked out.

mysql> repair table  tblauto_tagged;
+--------------------------------+--------+----------+---------------------------------    ------------------------+
| Table                          | Op     | Msg_type | Msg_text                                                   |
+--------------------------------+--------+----------+---------------------------------------------------------+
| collegedatabase.tblauto_tagged | repair | note     | The storage engine for the table     doesn't support repair |
+--------------------------------+--------+----------+---------------------------------------------------------+
1 row in set (0.00 sec) 

mysql> select * from tblauto_tagged;
Empty set (0.00 sec)

After all of yours helpful suggestion I used following statement

cursor.execute("INSERT INTO tblauto_tagged(tagger,train,propernoun,propernoun_ID) VALUES (?,?,?,?)",(str(iput),str(corpora),str(nnp_array[add1:add2]),0))

And I ran into another trouble and for sure today is not my day.In order to make my problem more clear, I am editing the question with some additional information. ever thing works fine till propernoun_SRNO =149

 mysql> select propernoun_SRNO ,tagger, train,propernoun,propernoun_ID from tblauto_tagged where propernoun_SRNO =149;
+-----------------+--------+-------+------------------------------------------------------------------------------------------------------------+---------------+
| propernoun_SRNO | tagger | train | propernoun                                                                                                   | propernoun_ID |
+-----------------+--------+-------+------------------------------------------------------------------------------------------------------------+---------------+
|             149 | 1      | 1     | ['Wing', 'tank', 'Hopper', 'BU', 'crewmember', 'beam', 'injured', 'Drug', 'Serious', 'Marine', 'Incident'] |             0 |
+-----------------+--------+-------+------------------------------------------------------------------------------------------------------------+---------------+

and after propernoun_SRNO = 150 this is what I get.

mysql> select propernoun_SRNO ,tagger, train,propernoun,propernoun_ID from tblauto_tagged where propernoun_SRNO =150;
+-----------------+--------+-------+------------+---------------+
| propernoun_SRNO | tagger | train | propernoun | propernoun_ID |
+-----------------+--------+-------+------------+---------------+
|             150 | 1      | 1     | []         |             0 |
+-----------------+--------+-------+------------+---------------+
1 row in set (0.00 sec)

which goes all the way down to propernoun_SRNO = 22201

mysql> select max(propernoun_SRNO) from tblauto_tagged;
+----------------------+
| max(propernoun_SRNO) |
+----------------------+
|                22201 |
+----------------------+
1 row in set (0.00 sec)

mysql> select propernoun_SRNO ,tagger, train,propernoun,propernoun_ID from tblauto_tagged where propernoun_SRNO =22201;
+-----------------+--------+-------+------------+---------------+
| propernoun_SRNO | tagger | train | propernoun | propernoun_ID |
+-----------------+--------+-------+------------+---------------+
|           22201 | 1      | 1     | []         |             0 |
+-----------------+--------+-------+------------+---------------+
1 row in set (0.00 sec)

I don’t know what the problem is but I think it needs some experts opinion. As mentioned in the previous comments should I use sequences, please advice

  • 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-11T06:45:20+00:00Added an answer on June 11, 2026 at 6:45 am

    To explain zerkms’s comment: You are trying to insert a row with a value for the primary key (propernoun_SRNO, if I’m not mistaken) which is already in use.

    If you are trying to insert all new rows to the database, don’t specify a value for the primary key, and MySQL should calculate one automatically, assuming that the column is set as AUTO_INCREMENT.

    If you are trying to replace existing rows with these IDs, use REPLACE instead of INSERT, or delete the existing rows before you insert new ones.

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

Sidebar

Related Questions

Having trouble with the following segment of code. I'm getting a parameter count mismatch.
Having a spot of trouble with the following code. The method NextIPID() should simply
I'm having some trouble understanding the following block of code: void InsertSorted(Entry * &
im having some trouble with the following code: Ext.define('...controller...', { extend: 'Ext.app.Controller', init: function()
I am having some trouble understanding the following simple C code: int main(int argc,
I am having trouble with the following simple code BindingList<Car> tempList = new BindingList<Car>();
Having trouble with each function... Will try to explain by example... In my code,
Having trouble accessing javascript code in a mixed html/js ajax response. jQuery ajax doc
Having trouble understanding. With the following css : .bloc .field:nth-last-child(2){ ...some values... } and
I am currently having trouble getting a value from an AsyncTask that gets data

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.