Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
701bf76
fix #483 and #516: .proj() preserves original order. Also rename cla…
dimitri-yatsenko Nov 13, 2018
38f1dba
Merge branch 'dev'
dimitri-yatsenko Nov 13, 2018
08e61e6
complete renaming query -> expression
dimitri-yatsenko Nov 13, 2018
025dd93
rename class Expression -> QueryExpression
dimitri-yatsenko Nov 13, 2018
1d5b593
add test for create_virtual_module and for issue #516
dimitri-yatsenko Nov 13, 2018
f0c8b8f
Merge branch 'master' of https://github.com/datajoint/datajoint-python
dimitri-yatsenko Nov 13, 2018
a348758
fix doc strings to use QueryExpression
dimitri-yatsenko Nov 13, 2018
8edb4d7
add test for QueryExpression iterator
dimitri-yatsenko Nov 13, 2018
85dca73
finish renaming query -> expression in fetch.py
dimitri-yatsenko Nov 13, 2018
470682a
update version and CHANGELOG for release 0.11.1
dimitri-yatsenko Nov 13, 2018
65ea0e7
minor
dimitri-yatsenko Nov 13, 2018
8cca325
minor
dimitri-yatsenko Nov 14, 2018
77644ee
increase timeout for nosetests in travis
dimitri-yatsenko Nov 14, 2018
b46b64b
change terminology from `relations` to `query expressions` in doc str…
dimitri-yatsenko Nov 14, 2018
277398f
undo travis setting -- travis still not working on GitHub
dimitri-yatsenko Nov 16, 2018
06d5cc3
undo inconsequential change from previous commit to try to figure out…
dimitri-yatsenko Nov 16, 2018
10f7393
simplify context management, move test initialization into setup_clas…
dimitri-yatsenko Nov 17, 2018
29ca4c9
remove make_module_code for lack of potential use, tagging this commi…
dimitri-yatsenko Nov 17, 2018
bae0900
remove erd.topological_sort -- it is never called
dimitri-yatsenko Nov 17, 2018
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
Prev Previous commit
Next Next commit
fix doc strings to use QueryExpression
  • Loading branch information
dimitri-yatsenko committed Nov 13, 2018
commit a3487583c045f38ba2925f9c57cb6bb8569fc3be
18 changes: 9 additions & 9 deletions datajoint/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def proj(self, *attributes, **named_attributes):
Primary key attributes are always cannot be excluded but may be renamed.
Thus self.proj() produces the relation with only the primary key of self.
self.proj(a='id') renames the attribute 'id' into 'a' and includes 'a' in the projection.
self.proj(a='expr') adds a new field a with the value computed with SQL expression.
self.proj(a='expr') adds a new field a with the value computed with an SQL expression.
self.proj(a='(id)') adds a new computed field named 'a' that has the same value as id
Each attribute can only be used once in attributes or named_attributes.
"""
Expand All @@ -251,7 +251,7 @@ def __iand__(self, restriction):
in-place restriction.
A subquery is created if the argument has renamed attributes. Then the restriction is not in place.

See expression.restrict for more detail.
See QueryExpression.restrict for more detail.
"""
if is_true(restriction):
return self
Expand All @@ -261,7 +261,7 @@ def __and__(self, restriction):
"""
relational restriction or semijoin
:return: a restricted copy of the argument
See expression.restrict for more detail.
See QueryExpression.restrict for more detail.
"""
return (Subquery.create(self) # the HAVING clause in GroupBy can handle renamed attributes but WHERE cannot
if not(is_true(restriction)) and self.heading.expressions and not isinstance(self, GroupBy)
Expand All @@ -271,7 +271,7 @@ def __isub__(self, restriction):
"""
in-place inverted restriction aka antijoin

See expression.restrict for more detail.
See QueryExpression.restrict for more detail.
"""
return self.restrict(Not(restriction))

Expand All @@ -280,7 +280,7 @@ def __sub__(self, restriction):
inverted restriction aka antijoin
:return: a restricted copy of the argument

See expression.restrict for more detail.
See QueryExpression.restrict for more detail.
"""
return self & Not(restriction)

Expand Down Expand Up @@ -324,7 +324,7 @@ def restrict(self, restriction):
Two tuples match when their common attributes have equal values or when they have no common attributes.
All shared attributes must be in the primary key of either rel or arg or both or an error will be raised.

expression.restrict is the only access point that modifies restrictions. All other operators must
QueryExpression.restrict is the only access point that modifies restrictions. All other operators must
ultimately call restrict()

:param restriction: a sequence or an array (treated as OR list), another relation, an SQL condition string, or
Expand Down Expand Up @@ -819,7 +819,7 @@ class U:

In aggregation, dj.U is used to compute aggregate expressions on the entire relation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These doc strings need to be updated to use the new terminology (i.e. no relation)


The following expression produces a relation with one tuple and one attribute s containing the total number
The following expression yields a relation with one tuple and one attribute s containing the total number
of tuples in relation:

>>> dj.U().aggr(relation, n='count(*)')
Expand Down Expand Up @@ -881,11 +881,11 @@ def __mul__(self, relation):

def aggr(self, group, **named_attributes):
"""
Aggregation of the type U('attr1','attr2').aggr(rel, computation="expression")
Aggregation of the type U('attr1','attr2').aggr(rel, computation="QueryExpression")
has the primary key ('attr1','attr2') and performs aggregation computations for all matching tuples of relation.
:param group: The other relation which will be aggregated.
:param named_attributes: computations of the form new_attribute="sql expression on attributes of group"
:return: The new relation
:return: The derived relation
"""
return (
GroupBy.create(self, group=group, keep_all_rows=False, attributes=(), named_attributes=named_attributes)
Expand Down