Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.122 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.76; '*S*': 0.00; 'badly': 0.07; 'to:name :python-list': 0.15; 're-run': 0.16; 'sqlalchemy': 0.16; 'message- id:@mail.gmail.com': 0.27; 'subject:all': 0.29; 'probably': 0.29; 'file': 0.32; 'running': 0.32; 'goes': 0.33; 'like:': 0.33; 'problem': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'sometimes': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'useful': 0.36; 'problems': 0.36; 'moment': 0.37; 'previous': 0.37; 'received:209': 0.37; 'data': 0.37; 'some': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'easily': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'your': 0.60; 'day': 0.73; 'simulations': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=P+Af+G/Au0dD0eSKhDnH0fga7rffQskgk5U0gAfcARQ=; b=IlMMk+v1HnAN9TZFqqci2+5/4IqBljTl1Te9Esvl7AwPeOTOXc617/S8nSJiv5TH+y qvMqVrw4JH7RoEjnbZa4B/NMcBDUXfJ7LecsRxbzMQMJ4e2T3rzhyWszKu7pEjF5wNUy zVycLEzvf5Canc6Lug4tF32kDS0L7fyPG2sU12hw3eIZR66XvTKqbLsNcydhFOQwpCR7 JFuHp1T0K5Ak2+nHx1ht/4xec0hM9MqrycIKjgLjEcHPoG/sNviFTDtcWlI5hjsiMjfg j/OdqvbagS0Sp5J28CDYxQRNRESwiRab9enGttlwK+1QPPzSH9rvOARFXPRrH2Nspk0Z w1jA== MIME-Version: 1.0 Date: Wed, 25 Jul 2012 14:56:42 +0100 Subject: Dumping all the sql statements as backup From: andrea crotti To: python-list Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343224604 news.xs4all.nl 6987 [2001:888:2000:d::a6]:32815 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26041 I have some long running processes that do very long simulations which at the end need to write things on a database. At the moment sometimes there are network problems and we end up with half the data on the database. The half-data problem is probably solved easily with sessions and sqlalchemy (a db-transaction), but still we would like to be able to keep a backup SQL file in case something goes badly wrong and we want to re-run it manually.. This might also be useful if we have to rollback the db for some reasons to a previous day and we don't want to re-run the simulations.. Anyone did something similar? It would be nice to do something like: with CachedDatabase('backup.sql'): # do all your things