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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:11:45+00:00 2026-05-31T05:11:45+00:00

I have an odd problem. There are two databases. One has all products in

  • 0

I have an odd problem.
There are two databases. One has all products in it for an online shop. The other one has the online-shop software on it and only the active products.

I want to take the values from db1, change some values in python and insert into db2.

db1.execute("SELECT * FROM table1")
for product in db1.fetchall():
    # ...
    db2.execute("INSERT INTO table2 ...")
    print "Check: " + str(db2.countrow)

So I can get the values via select, even selecting from db2 is no problem. My check always gives me 1 BUT there are no new rows in table2. The autoincrement value grows but the there is no data.
And I dont even get an error like “couldnt insert”
So does anybody has an idea what could be wrong? (if i do an insert manually via phpmyadmin it works… and if i just take the sql from my script and do it manually the sql-statements work aswell)

EDIT: Found the answer here How do I check if an insert was successful with MySQLdb in Python?

Is there a way to make these executes without committing everytime?
I have a wrapper around the mysqldb and it works perfectly for me, changing the behaviour with commit I need to make some big changes.

EDIT2: ok i found out that db1 is MyISAM (which would work without commiting) and db2 is InnoDB (which actually seems only to work with commiting) I guess I have to change db2 to MyISAM aswell.

  • 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-05-31T05:11:45+00:00Added an answer on May 31, 2026 at 5:11 am

    Try adding db2.commit() after the inserts if you’re using InnoDB.

    Starting with 1.2.0, MySQLdb disables autocommit by default, as
    required by the DB-API standard (PEP-249). If you are using InnoDB
    tables or some other type of transactional table type, you’ll need to
    do connection.commit() before closing the connection, or else none of
    your changes will be written to the database.

    http://mysql-python.sourceforge.net/FAQ.html#my-data-disappeared-or-won-t-go-away

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

Sidebar

Related Questions

I have an odd problem...I'm using a documentation generator which generates a lot of
I have an odd problem in VS2008 running unit tests. When I run the
I have the odd problem that I am not able to open the properties
I have an odd problem with Django. I have a set of objects that
I have an odd problem where Hibernate is running more queries than I've asked
I recently encountered an odd problem with RSACryptoServiceProvider.VerifyHash . I have a web application
I am having a really odd problem with Flash CS4. I have a MovieClip
I have an odd need to open two separate instances of excel and having
I have an odd problem. I have a page called search.aspx. When the search
We are having an odd problem with .NET Remoting. Basically, we have a server

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.