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

References <CAF_E5JYTMZ9CbAeSabdoK9HfHQ5tgdSnGFua5nQL6kQ85nw2tw@mail.gmail.com> <5010083D.4080307@gmail.com>
Date 2012-07-25 16:31 +0100
Subject Re: Dumping all the sql statements as backup
From andrea crotti <andrea.crotti.0@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2574.1343230304.4697.python-list@python.org> (permalink)

Show all headers | 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