Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2015
    Posts
    2

    Question Unanswered: Problems Updating Programatically a Database Using MySQLdb-pyton

    Hello all,

    I have a problem with mysqldb-python for python 2.7.

    I am unsure about .add() and .merge()
    As far as I can tell the Identity Mapping structure created by session_maker
    would not accept objects with same id. Therefore, we need to use merge.

    How do I update the db, should I do something like
    HTML Code:
    try:
        add(whatever)
        commit()
    except :
        rollback
        # didn't work, now try merge
        merge(whatever)
        commit()
    Help please. Thank you.
    Last edited by quaere1verum; 02-12-15 at 14:59.

  2. #2
    Join Date
    Feb 2015
    Posts
    2

    Question MySQLdb Python problem updating DB

    Hello all,

    I have problems updating my database programaticallly.
    I am using .merge() and .add() apparently the difference is in the id used for objects in
    the identity mapping used by session_maker.

    I need to update the database, but currently I am unsuccessful any idea.
    I have also tried.

    Code:
    try:
        add(something)
        commit()
    except:
        rollback()
        merge(something)
        commit()
    The code still doesn't update the db. Help?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •