Skip to content

Commit 2fb6558

Browse files
committed
Addressing @ElDeveloper's comments
1 parent 7324daf commit 2fb6558

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

qiita_db/metadata_template/base_metadata_template.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -793,17 +793,14 @@ def _add_common_extend_steps_to_queue(self, md_template, conn_handler,
793793
"""
794794
# Check if we are adding new samples
795795
sample_ids = md_template.index.tolist()
796-
sql = """SELECT sample_id FROM qiita.{0}
797-
WHERE {1}=%s""".format(self._table, self._id_column)
798-
curr_samples = set(
799-
s[0] for s in conn_handler.execute_fetchall(sql, (self._id,)))
796+
curr_samples = set(self.keys())
800797
existing_samples = curr_samples.intersection(sample_ids)
801798
new_samples = set(sample_ids).difference(existing_samples)
802799

803800
# Check if we are adding new columns
804801
table_name = self._table_name(self._id)
805802
# Get the required columns from the DB
806-
db_cols = sorted(get_table_cols(self._table, conn_handler))
803+
db_cols = get_table_cols(self._table, conn_handler)
807804
# Remove the sample_id and _id_column columns
808805
db_cols.remove('sample_id')
809806
db_cols.remove(self._id_column)
@@ -837,10 +834,9 @@ def _add_common_extend_steps_to_queue(self, md_template, conn_handler,
837834

838835
if existing_samples:
839836
warnings.warn(
840-
"The new columns '%s' have been added to the existing "
841-
"samples '%s'. Any other value of these samples have been "
842-
"modified." % (", ".join(new_cols),
843-
", ".join(existing_samples)),
837+
"No values have been modified for samples '%s'. However, "
838+
"the following columns have been added to them: '%s'"
839+
% (", ".join(existing_samples), ", ".join(new_cols)),
844840
QiitaDBWarning)
845841
# The values for the new columns are the only ones that get
846842
# added to the database. None of the existing values will be

0 commit comments

Comments
 (0)