diff --git a/datajoint/fetch.py b/datajoint/fetch.py index 61a911ba5..4474482ac 100644 --- a/datajoint/fetch.py +++ b/datajoint/fetch.py @@ -280,6 +280,9 @@ def __getitem__(self, item): item, attributes = prepare_attributes(self._relation, item) result = self._relation.project(*attributes).fetch() + if len(result) != 1: + raise DataJointError('Fetch1 should only return one tuple') + return_values = tuple( np.ndarray(result.shape, np.dtype({name: result.dtype.fields[name] for name in self._relation.primary_key}), diff --git a/datajoint/heading.py b/datajoint/heading.py index 7a742416b..a08e3f3af 100644 --- a/datajoint/heading.py +++ b/datajoint/heading.py @@ -230,7 +230,7 @@ def project(self, *attribute_list, **renamed_attributes): def join(self, other, left): """ - join two headings + Joins two headings. """ assert isinstance(other, Heading) attribute_list = [v._asdict() for v in self.attributes.values()] diff --git a/datajoint/relational_operand.py b/datajoint/relational_operand.py index 3ee4e3bf4..f3e25b0d2 100644 --- a/datajoint/relational_operand.py +++ b/datajoint/relational_operand.py @@ -339,7 +339,7 @@ def from_clause(self): @property def select_fields(self): - return '*' + return self.heading.as_sql class Projection(RelationalOperand):