Skip to content

Commit da56fc5

Browse files
committed
Enforcing order in database cols
1 parent 2199bdd commit da56fc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qiita_db/metadata_template/base_metadata_template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ def _add_common_creation_steps_to_queue(cls, md_template, obj_id,
542542
headers = list(md_template.keys())
543543

544544
# Get the required columns from the DB
545-
db_cols = get_table_cols(cls._table, conn_handler)
545+
db_cols = sorted(get_table_cols(cls._table, conn_handler))
546546
# Remove the sample_id and _id_column columns
547547
db_cols.remove('sample_id')
548548
db_cols.remove(cls._id_column)
@@ -561,7 +561,7 @@ def _add_common_creation_steps_to_queue(cls, md_template, obj_id,
561561
values, many=True)
562562

563563
# Insert rows on *_columns table
564-
headers = list(set(headers).difference(db_cols))
564+
headers = sorted(list(set(headers).difference(db_cols)))
565565
datatypes = get_datatypes(md_template.ix[:, headers])
566566
# psycopg2 requires a list of tuples, in which each tuple is a set
567567
# of values to use in the string formatting of the query. We have all

0 commit comments

Comments
 (0)