commit/galaxy-central: dannon: Added row id print and pre/post value prints to the migration script addressing form value errors.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/6ffd5bca9d84/ changeset: r5239:6ffd5bca9d84 user: dannon date: 2011-03-21 16:08:32 summary: Added row id print and pre/post value prints to the migration script addressing form value errors. affected #: 1 file (348 bytes) --- a/lib/galaxy/model/migrate/versions/0076_fix_form_values_data_corruption.py Fri Mar 18 15:23:27 2011 -0400 +++ b/lib/galaxy/model/migrate/versions/0076_fix_form_values_data_corruption.py Mon Mar 21 11:08:32 2011 -0400 @@ -20,7 +20,6 @@ def _sniffnfix_pg9_hex(value): """ Sniff for and fix postgres 9 hex decoding issue - """ try: if value[0] == 'x': @@ -33,7 +32,6 @@ def upgrade(): print __doc__ metadata.reflect() - cmd = "SELECT form_values.id as id, form_values.content as field_values, form_definition.fields as fields " \ + " FROM form_definition, form_values " \ + " WHERE form_values.form_definition_id=form_definition.id " \ @@ -50,6 +48,12 @@ # content field is corrupted fields_list = from_json_string( _sniffnfix_pg9_hex( str( row['fields'] ) ) ) field_values_str = _sniffnfix_pg9_hex( str( row['field_values'] ) ) + try: + #Encoding errors? Just to be safe. + print "Attempting to fix row %s" % row['id'] + print "Prior to replacement: %s" % field_values_str + except: + pass field_values_dict = {} # look for each field name in the values and extract its value (string) for index in range( len(fields_list) ): @@ -84,10 +88,15 @@ json_values = to_json_string(field_values_dict) cmd = "UPDATE form_values SET content='%s' WHERE id=%i" %( json_values, int( row['id'] ) ) db_session.execute( cmd ) + try: + print "Post replacement: %s" % json_values + except: + pass if corrupted_rows: print 'Fixed %i corrupted rows.' % corrupted_rows else: print 'No corrupted rows found.' def downgrade(): - pass \ No newline at end of file + pass + Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket