From 15821817015868b370a5a1bf52452bd8d3c96317 Mon Sep 17 00:00:00 2001 From: Elrond Date: Sun, 22 Jan 2012 16:57:56 +0100 Subject: [PATCH] mongo to sql convert: Better Ordering Order the conversion by the "created" attribute. That way the sql ids are mostly in the order they would have been, if sql was used earlier. Makes things nicer to look at in a db dump. --- mediagoblin/db/sql/convert.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mediagoblin/db/sql/convert.py b/mediagoblin/db/sql/convert.py index 36d6fc7f..f5c93af5 100644 --- a/mediagoblin/db/sql/convert.py +++ b/mediagoblin/db/sql/convert.py @@ -49,7 +49,7 @@ def copy_reference_attr(entry, new_entry, ref_attr): def convert_users(mk_db): session = Session() - for entry in mk_db.User.find(): + for entry in mk_db.User.find().sort('created'): print entry.username new_entry = User() @@ -71,7 +71,7 @@ def convert_users(mk_db): def convert_media_entries(mk_db): session = Session() - for entry in mk_db.MediaEntry.find(): + for entry in mk_db.MediaEntry.find().sort('created'): print repr(entry.title) new_entry = MediaEntry() @@ -100,7 +100,7 @@ def convert_media_tags(mk_db): session = Session() session.autoflush = False - for media in mk_db.MediaEntry.find(): + for media in mk_db.MediaEntry.find().sort('created'): print repr(media.title) for otag in media.tags: @@ -127,7 +127,7 @@ def convert_media_tags(mk_db): def convert_media_comments(mk_db): session = Session() - for entry in mk_db.MediaComment.find(): + for entry in mk_db.MediaComment.find().sort('created'): print repr(entry.content) new_entry = MediaComment()