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

Closed
wants to merge 67 commits into from
Closed

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`.

@ethho ethho mentioned this pull request Sep 9, 2024
@ethho
Copy link
Contributor

ethho commented Sep 9, 2024

This PR needs to:

  • Merge master
  • Update tests so that they're compatible with the new pytest-based suite.

Continuing work on this at #1178.

@ethho ethho closed this Sep 9, 2024
ethho added a commit that referenced this pull request Sep 12, 2024
ethho added a commit that referenced this pull request Sep 12, 2024
dimitri-yatsenko added a commit that referenced this pull request Sep 12, 2024
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.
4 participants