Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions datajoint/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}),
Expand Down
2 changes: 1 addition & 1 deletion datajoint/heading.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand Down
2 changes: 1 addition & 1 deletion datajoint/relational_operand.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def from_clause(self):

@property
def select_fields(self):
return '*'
return self.heading.as_sql


class Projection(RelationalOperand):
Expand Down