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

[NEW] Bulk Delete Workaround #25

Closed
joan-ing opened this issue Jul 13, 2023 · 3 comments · Fixed by #240
Closed

[NEW] Bulk Delete Workaround #25

joan-ing opened this issue Jul 13, 2023 · 3 comments · Fixed by #240
Assignees

Comments

@joan-ing
Copy link

Feedback

Would like to see an example of deleting all rows matching a specific criteria. That could also include matching against linked data. If that is possible?
Workaround for now filter out all ids matching a linked column and then make multiple calls to delete. Just felt a bit inefficient :)

Route

https://xata.io/docs/api-guide/delete

From

lindgr3n

Original issue: https://github.com/xataio/docs/issues/82

@joan-ing joan-ing self-assigned this Jan 23, 2024
@joan-ing
Copy link
Author

Transactions can be used for bulk deletion. "Transactions are used when deleting multiple records:” which is documented for delete, but can make this clearer

@SferaDev
Copy link
Member

I think for this scenario, SQL is the best answer

@joan-ing
Copy link
Author

joan-ing commented Feb 1, 2024

Had a conversation with @SferaDev. The SQL proxy limitation for this is a backend issue. Suggesting the following SQL based on Alexis and Kostas (suggestion in Discord)

DELETE FROM titles WHERE id IN ( SELECT id FROM titles WHERE originalTitle ILIKE '%Matrix%' LIMIT 10000 );

github-merge-queue bot pushed a commit that referenced this issue Feb 6, 2024
Closes #25 #42 

## Summary

<!-- Add a brief description of changes -->

- **Adding examples and timeout note** - Adding examples to the
transactions doc and clarifying language. Also including the timeout
that occurs with bulk deletes mentioned in
[Discord](https://discord.com/channels/996791218879086662/1075788625586966637/threads/1201746322370342952)

---

<!-- Remove this entire section if not needed -->

### Remaining work

The following work still needs to be completed:

- [ ] <List outstanding tasks here>

### Dependencies

- [ ] <Tasks that must be completed before merging this pull request>

---

### Timing

**Release**:

- [ ] When ready
- [ ] Hold for release | Release after: <mm/dd/yy>

---------

Co-authored-by: Philip Krauss <35487337+philkra@users.noreply.github.com>
Co-authored-by: Kostas Botsas <kostas@xata.io>
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 a pull request may close this issue.

2 participants