Giter VIP home page Giter VIP logo

Comments (10)

knazarov avatar knazarov commented on August 11, 2024 1

I'm against extending the API to have methods that are created for the bulk update of whole spaces. This has the ability to lock the whole instance for a long time.

from crud.

Totktonada avatar Totktonada commented on August 11, 2024 1

We discussed it with the product team and decided to don't implement it here. Sorry, Alexey.

from crud.

akudiyar avatar akudiyar commented on August 11, 2024

Big selects have the same ability, and delete operation has been already supporting conditions. It is a matter of a convenient API and not forcing customers to write boilerplate code.

Consider the case when we substitute UPDATE .. WHERE SQL operation with a CRUD analog. Should we load data one by one from a large space to the client or maybe updating it in place is better?

from crud.

knazarov avatar knazarov commented on August 11, 2024

That's why we will incur the same limitation we have for selects as we have in Data Grid. There will be a limit on how many rows a select can scan before returning with an error. Unbound selects shouldn't be allowed.

Yes, I believe it's better to pull data to the client and then update it in batches. It will keep the database operational at least. Doing an update that touches the whole data set will just freeze the database.

If you want to do an update of around 1-10 items, then pulling them to the client should not be a problem. If you want to update the whole table, then you've clearly picked the wrong way to implement it.

from crud.

knazarov avatar knazarov commented on August 11, 2024

Updating whole datasets should be done by a background task.

from crud.

akudiyar avatar akudiyar commented on August 11, 2024

If you mean "asynchronous" task which reports events about its state, it is a good case and may be supported in the connectors. So the users may wait or not until the task finishes, which depends on the business scenario. In this case, it seems like an implementation detail, and the update API may look like the proposed above.

Btw, the delete() operation has the same API now.

from crud.

akudiyar avatar akudiyar commented on August 11, 2024

If you want to do an update of around 1-10 items, then pulling them to the client should not be a problem. If you want to update the whole table, then you've clearly picked the wrong way to implement it.

It looks like "select for update" and I am afraid it is less efficient than the built-in in-place update.

from crud.

knazarov avatar knazarov commented on August 11, 2024

The delete API doesn't have the same signature. It doesn't have the condition as in select. You can only delete by primary key. And it's a deliberate choice.

I already told you that we won't support mass updates from the update function. It can block the event loop for a long time and we don't want that.

from crud.

akudiyar avatar akudiyar commented on August 11, 2024

But what do you think about the mass updates in an asynchronous task which returns a future and produces events? Batch update using small portions of data may be implemented in CRUD this way.

from crud.

knazarov avatar knazarov commented on August 11, 2024

The current API is stateless and doesn't support long-running tasks. And the basic CRUD operations won't be stateful by design. This is a deliberate choice.

In the future, it is possible that we will make some sort of background tasks, but I will resist it unless there is a solid argument for why they are useful.

For now, use "select for update". It should solve most of your problems.

from crud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.