Locking tables with SQLAlchemy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcmc
    New Member
    • Jun 2007
    • 6

    #1

    Locking tables with SQLAlchemy

    Hi,
    I need to lock a table for WRITE.
    The scenario is that I have a SELECT followed by an INSERT, where the INSERT depends on the outcome of the SELECT. I have to make sure that no other process is modifying the table after my SELECT but before my INSERT.

    1) How do i do it via SQLAlchemy ?
    2) Is there any other method (not via locks) to achieve my goal?

    TIA
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by mcmc
    Hi,
    I need to lock a table for WRITE.
    The scenario is that I have a SELECT followed by an INSERT, where the INSERT depends on the outcome of the SELECT. I have to make sure that no other process is modifying the table after my SELECT but before my INSERT.

    1) How do i do it via SQLAlchemy ?
    2) Is there any other method (not via locks) to achieve my goal?

    TIA
    SQLAlchemy looks like a very interesting and well put-together package.
    I curious about what the actual database that you are using is. Am I correct in assuming that SQLAlchemy will connect to an installed database?

    Comment

    • mcmc
      New Member
      • Jun 2007
      • 6

      #3
      I am using MySQL.
      I did not understand the 2nd question.

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by mcmc
        I am using MySQL.
        I did not understand the 2nd question.
        That answers my question and helps a lot. I'm going to check out this SA thing and see if will be appropriate for my projects. Then, perhaps, we'll be able to help each other.

        It looks like a very useful tool.

        Comment

        Working...