Transactional migration?

0 views
Skip to first unread message

Guyren G Howe

unread,
Sep 9, 2010, 7:24:51 PM9/9/10
to turbo...@googlegroups.com
I'm surprised to find that migrations in the latest TurboGears aren't run in a transaction. Since I'm using Postgres, they clearly should.

An obvious solution (a decorator that wraps the upgrade/downgrade functions with transaction commands) isn't working, and besides, you'd really want the whole sequence of migrations wrapped in an outer transaction, I'm wondering if I'm just missing a setting or something.

Gisborne

unread,
Sep 10, 2010, 2:47:45 PM9/10/10
to TurboGears
Guyren G Howe wrote:
> I'm surprised to find that migrations in the latest TurboGears aren't run in a transaction. Since I'm using Postgres, they clearly should.
>
> An obvious solution (a decorator that wraps the upgrade/downgrade functions with transaction commands) isn't working, and besides, you'd really want the whole sequence of migrations wrapped in an outer transaction, I'm wondering if I'm just missing a setting or something.

Bump. No-one?

Michael Pedersen

unread,
Sep 10, 2010, 2:59:29 PM9/10/10
to turbo...@googlegroups.com
What's missing is that many databases don't do transactions around these sorts of statements. Or, at the least, they didn't. create table, alter table, etc, all of these occur outside of transactions. Since more than PostgreSQL has to be accommodated, and PG is one of the few to support this. Even with its support for it, I honestly don't know if SQLAlchemy supports the idea of creating/dropping/altering tables in a transaction.

The idea is a good one. Unfortunately, from what I can tell, it's not something that can be done easily, if at all, in a cross-database fashion.


--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.




--
Michael J. Pedersen
My IM IDs: Jabber/pede...@icelus.tzo.com, ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/pederm...@hotmail.com

Guyren G Howe

unread,
Sep 10, 2010, 3:52:22 PM9/10/10
to turbo...@googlegroups.com
On Sep 10, 2010, at 11:59 , Michael Pedersen wrote:
> What's missing is that many databases don't do transactions around these sorts of statements. Or, at the least, they didn't. create table, alter table, etc, all of these occur outside of transactions. Since more than PostgreSQL has to be accommodated, and PG is one of the few to support this. Even with its support for it, I honestly don't know if SQLAlchemy supports the idea of creating/dropping/altering tables in a transaction.
>
> The idea is a good one. Unfortunately, from what I can tell, it's not something that can be done easily, if at all, in a cross-database fashion.

It would be a service that the database adapter would supply. Doesn't seem as though it would be difficult to do assuming the interface between the database adapter and the rest of the framework was structured the right way.

Maybe it's something I'll look into writing.

Reply all
Reply to author
Forward
0 new messages