Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dj.U for Universal Sets #144

Open
austin-hilberg opened this issue Dec 18, 2018 · 1 comment
Open

Implement dj.U for Universal Sets #144

austin-hilberg opened this issue Dec 18, 2018 · 1 comment

Comments

@austin-hilberg
Copy link
Contributor

No description provided.

@guzman-raphael
Copy link
Collaborator

With the addition of ONLY_FULL_GROUP_BY option to the datajoint/mysql recently, there is increased need and priority for this feature as simple, single-table aggregations (e.g. summation of all values in a column) that were allowed before are no longer properly defined queries.

As an example, previously this would work:

>> University.Student().proj('max(student_id) -> max_id')
ans = 
Object dj.internal.GeneralRelvar
 0:  fakeservices.datajoint.io via TCP/IP   Server version 5.7.33 (encrypted)
    STUDENT_ID    max_id
    __________    ______
    1             3     
3 tuples (0.871 s)

However, it will now (as intended) throw this error on database servers with the new option:

>> University.Student().proj('max(student_id) -> max_id')
ans = 
Object dj.internal.GeneralRelvar
Error using mym
In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column
'djtest_university.student.student_id'; this is incompatible with sql_mode=only_full_group_by
Error in dj.Connection/query (line 183)
                ret=mym(self.connId, queryStr, v{:});
Error in dj.internal.GeneralRelvar/fetch (line 213)
            ret = self.conn.query(sprintf('SELECT %s FROM %s%s', ...
Error in dj.internal.GeneralRelvar/disp (line 89)
            preview = self.fetch(attrList{:}, sprintf('LIMIT %d', maxRows+1));

The real solution for this will be to structure a query with the new universal set feature once completed. The workaround for now is to simply fetch and perform the aggregation client side until this enhancement is implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants