Git Product home page Git Product logo

Comments (4)

azylman avatar azylman commented on August 22, 2024

The first error is happening because we add page parameters to all requests from all. Because we paginate automatically, we disallow sending limit and page, which causes the second error.

Not sure if there should be a special case for distinct in these functions, or if distinct should be broken out into its own method, a.la. clever.Section.distinct("period").

I think from a readability/code complexity point of view, the second one is probably better (and I would lean towards that), but you could also make an argument that the smaller the API profile, the better (e.g. currently we only have two methods: iter and all).

from clever-python.

nathanleiby avatar nathanleiby commented on August 22, 2024

@azylman why doesn't distinct allow pagination?

from clever-python.

nathanleiby avatar nathanleiby commented on August 22, 2024

@dccarroll - Interesting catch - I didn't realize these were interdependent when we hardcoded limit for pagination purposes.

limit implies two things (1) MAX results to return (2) PAGE_SIZE. I suggest that clever-python hides (2) from the library consumer. (1) seems a much more sensible way of thinking about it from the library's perspective.

I don't like adding another method either; however, we might consider that the parameters need not exactly map to the API. as we do with all(), there could be more abstraction between the goal (fetching distinct items) and exactly what query parameters get passed behind the scenes to the API.

from clever-python.

azylman avatar azylman commented on August 22, 2024

No idea, I just know the API rejects any query parameters with distinct except where and limit.

Maybe the aggregation pipeline (which we use for distinct) doesn't offsets?

from clever-python.

Related Issues (17)

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.