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.106 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.00; 'badly': 0.07; 'received :mail-qc0-f174.google.com': 0.09; 're-run': 0.16; 'sqlalchemy': 0.16; 'sender:addr:gmail.com': 0.18; 'header:In-Reply-To:1': 0.25; 'first,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'end,': 0.29; '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; 'process,': 0.35; 'remote': 0.35; '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; 'received:209.85.216': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'store': 0.38; '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; 'locally': 0.84; 'simulations': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=QondiUkj0r953JTVosCsosspfyG328h9t7/C9JonZ4s=; b=K80qFt7XYxGlxy03QVvEw3AJF1h9gi90zYZNoEu7UxLtWw09Ehe1pv3lrCgsCIwEaT t1CXph4ZH4NO2BIzslRDbcN+/dvdziHZe3NvAJY0DtQZX6DRQeHprZUWyDWjLxgNaP7D sS54m1xgCsXu/qj/YRFFgIeRVzhYR6saV8aNu/rbddOJNKfkHAiy0jWQ/x6EyipkvfK4 G+fOdsVdmIv5MD36KVu1s97+rM+aZEaOhjxf9I+4O7L021NYPXjMjHniAKKy8iPti95o 3VjWXGS4Cbv3F4a9MSpS1SYO5CutNifeHtMtEQbu0JLUT8hvZPze/D+V+s/oupDPme65 RucQ== MIME-Version: 1.0 Sender: jsf80238@gmail.com In-Reply-To: References: Date: Thu, 30 Aug 2012 20:22:43 -0600 X-Google-Sender-Auth: R3WMYla8CzUy4nK6So88M-bOvMw Subject: Re: Dumping all the sql statements as backup From: Jason Friedman To: python-list@python.org 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346379766 news.xs4all.nl 6909 [2001:888:2000:d::a6]:40526 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28156 >> 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 > " ... at the end need to write things on a database ... " Is it necessary to write those things during the process, or only at the end? If only at the end, can you write locally first, and then write that local store to your remote database?