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

dj.Top restriction #1084

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open

dj.Top restriction #1084

wants to merge 67 commits into from

Conversation

A-Baji
Copy link
Collaborator

@A-Baji A-Baji commented May 11, 2023

No description provided.

datajoint/condition.py Outdated Show resolved Hide resolved
@A-Baji A-Baji linked an issue May 17, 2023 that may be closed by this pull request
@A-Baji A-Baji marked this pull request as ready for review May 17, 2023 19:34
@A-Baji A-Baji removed the request for review from guzman-raphael June 19, 2023 15:16
@A-Baji
Copy link
Collaborator Author

A-Baji commented Jun 23, 2023

Screenshot for reference:
image


Similar to the univeral set operator, the top operator uses `dj.Top` notation. It is used to
restrict a query by the given `limit`, `order_by`, and `offset` parameters:

Copy link
Contributor

Choose a reason for hiding this comment

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

| Parameter | Keyword Arguments | Default Argument | Description |
| -- | -- | -- | -- |
| `limit` | | 1 | Restrict the number of rows returned. |
| `order_by` | "KEY", "DESC", "ASC" | "KEY" |  |
| `offset` | | 0  |  |

Copy link
Contributor

Choose a reason for hiding this comment

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

Please fill out the rest of the table. And perhaps the headings I am using (Keyword Arguments, Default Argument) are not the clearest, so feel free to replace.

Similar to the univeral set operator, the top operator uses `dj.Top` notation. It is used to
restrict a query by the given `limit`, `order_by`, and `offset` parameters:

```python
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
```python
Examples
```python

The result of this expression returns the first 10 rows of `Session` and sorts them
by their `session_date` in ascending order.

### `order_by`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
### `order_by`

Comment on lines +243 to +244
The default values for `dj.Top` parameters are `limit=1`, `order_by="KEY"`, and `offset=0`.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The default values for `dj.Top` parameters are `limit=1`, `order_by="KEY"`, and `offset=0`.

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

Successfully merging this pull request may close these issues.

New type of restriction: top rows.
3 participants