Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26043

Re: Dumping all the sql statements as backup

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'works.': 0.07; 'retry': 0.09; 'cc:addr:python-list': 0.10; 'archive': 0.11; 'dump': 0.16; 'sqlalchemy,': 0.16; 'duplicate': 0.17; 'code,': 0.18; 'file.': 0.20; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'logging': 0.27; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'statements': 0.29; 'url:mailman': 0.29; 'subject:all': 0.29; 'maybe': 0.29; 'connection': 0.30; 'code': 0.31; 'url:python': 0.32; 'file': 0.32; 'url:listinfo': 0.32; 'problem': 0.33; 'received:google.com': 0.34; 'needed': 0.35; 'data,': 0.35; 'filter': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'add': 0.36; 'but': 0.36; 'url:org': 0.36; 'problems': 0.36; 'possible': 0.37; 'execute': 0.37; 'does': 0.37; 'option': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'some': 0.38; 'easily': 0.39; 'build': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'enable': 0.60; 'construct': 0.84; 'similar)': 0.84; 'solvable': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=WAeMgGmt6RMMvHXfsa93797PnnIjusLrtj8iX/Sg5Pw=; b=0cI14XZ7TIzmIuffhM0p5U72t9sUjx/EKaxB7/5NBZEV3w9vYn5kwbM6qZqgx/+L7h hGWs5FlW9Z75sAJLVlHtTtGn1NshvYsL3cJn2z+4KBqa8U/kmtsTG6liWeb3WhHX7g4l 8wQiAm4f7JJBDv5Latu6OQQBzN1ito8F3tc/OVcKRxoztbl3qIzfqUOL23DmnXxM6RTe vUBA3QWSShDvAzqHWtbmtpX4bU7je16M/MvtVeMHyB9mg7ysl8PSAJj3c1ZZUqTgLdul Ag1uD5pTrRlni6NJQM+mfSz5tdT4H8Yft+1d+5CDUWXL2d/5nCeXOGQdw3KOHCpDvO3T qxgg==
MIME-Version 1.0
In-Reply-To <5010083D.4080307@gmail.com>
References <CAF_E5JYTMZ9CbAeSabdoK9HfHQ5tgdSnGFua5nQL6kQ85nw2tw@mail.gmail.com> <5010083D.4080307@gmail.com>
Date Wed, 25 Jul 2012 16:31:43 +0100
Subject Re: Dumping all the sql statements as backup
From andrea crotti <andrea.crotti.0@gmail.com>
To Jack <tdldev@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2574.1343230304.4697.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343230304 news.xs4all.nl 6879 [2001:888:2000:d::a6]:52010
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26043

Show key headers only | View raw


2012/7/25 Jack <tdldev@gmail.com

> Since you know the content of what the sql code is, why not just build
> the sql file(s) needed and store them so that in case of a burp you can
> just execute the code file. If you don't know the exact sql code, dump
> it to a file as the statements are constructed... The only problem you
> would run into in this scenario is duplicate data, which is also easily
> solvable by using transaction-level commits to the db.
> --
> http://mail.python.org/mailman/listinfo/python-list


Yes but how do I construct them with SqlAlchemy?
One possible option I found is to enable the logging of some parts of
SqlAlchemy, and use that log, (echo=True in create_engine does
something similar) but maybe there is a better option..

But I need to filter only the insert/update/delete probably..

And in general the processes have to run independently so in case of
database connection problems I would just let them retry until it
actually works.

When the transaction actually works then in the backed up log I can
add a marker(or archive the log), to avoid replaying it.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Dumping all the sql statements as backup andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-25 16:31 +0100

csiph-web