Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nashvegas or schematic now with python?

14 views
Skip to first unread message

Axel Hecht

unread,
Jul 29, 2011, 1:15:57 PM7/29/11
to mozilla-t...@lists.mozilla.org
Hi,

I've been hacking away on the first real migration for data1.1 today,
and I'm hitting a wall with nashvegas.

OTH, schematic apparently now supports also python scripts [1].

The difference is that nashvegas executes the python scripts with
execfile, and schematic just runs them through python, in an extra process.

The benefit of the latter is that all the tweaks to add intermediate
models to do the migration code are contained in that one migration
process, and don't kill the actual migration parent.

To be concrete:

I create a fake AppVersion to move the Trees from tree and lasttree
foreignkey to a DurationRelField.

To get to the fake AppVersion, I need to put it into a different model
than shipping, as django refuses to overload that.

All fine, up to the point where my migration is done, and the postsync
signal is sent. Then my fake app for the fake model is still around, and
cause all hell of validation errors. Stupid biatch.

And the execfile sandbox is soooo sandboxed that I can ruin the the
outer context, but I can't fix it anymore, it seems.

Thus, having an extra process sounds really compelling.

Downside, as we don't have a mysql client on the bm-l10n-dashboard01,
we'd have to write all migrations in python, even those that are simple
SQL. Not that bad, though, get the cursor(), execute, get the same monty.
Another downside, schematic doesn't send postsync at all, but maybe we
can hack that in?

What do you guys think?

Axel

[1]
https://github.com/jbalogh/schematic/commit/de5d7b4b75695ca35aec1ef5f8ed53ff5b077457

Peter Bengtsson

unread,
Aug 1, 2011, 7:30:58 AM8/1/11
to tools...@lists.mozilla.org

Looks like we're caught between a rock and a hard place.
Considering that what you're working is such an important and
significant change; could you consider a one off script? E.g.
./scripts/pikes-data1.1-super-migration.py

Then you can load the django context and have full access to EVERYTHING
including sending raw SQL either by doing MyModel.objects.raw(...) or by
using the DATABASES cursor itself.
> Axel
>
> [1]
> https://github.com/jbalogh/schematic/commit/de5d7b4b75695ca35aec1ef5f8ed53ff5b077457
> _______________________________________________
> Tools-elmo mailing list
> Tools...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/tools-elmo

Axel Hecht

unread,
Aug 2, 2011, 5:38:15 AM8/2/11
to mozilla-t...@lists.mozilla.org
Hi,

to close this thread, we've talked about this on the elmo call.

We'll stick with nashvegas, and we'll just document that migrations that
use intermediate models for migration code will get failure on the
post-sync signal verification. That's sad, but it's not too bad as the
actual migrations work fine.

Axel

0 new messages