Git Product home page Git Product logo

Comments (4)

jecolvin avatar jecolvin commented on August 26, 2024 2

For sure! <assignment_id> is a child of <project_id> in a one-to-many relationship -- each project has many assignments, but each assignment belongs to only one project.

Edit: If it helps, the assignment endpoint relies on project_id as well, it's just the first part of the subtask endpoint -- /api/v1/projects/<project_id>/assignments

from verified-sources.

jecolvin avatar jecolvin commented on August 26, 2024

I'll add another vote to this enhancement! Currently working with an API that wants two different IDs in the endpoint to return subtask data:

/api/v1/projects/<project_id>/assignments/<assignment_id>/subtasks

from verified-sources.

burnash avatar burnash commented on August 26, 2024

Hey @jecolvin thanks for the input. Could you please share how <project_id> and <assignment_id> are related? dlt needs to figure out how to iterate over both <project_id> and <assignment_id>.

from verified-sources.

jecolvin avatar jecolvin commented on August 26, 2024

@burnash Followup on my work and a proposal for a v1 of this feature:

I discovered I could get the project_id form the assignment endpoint, it was just named differently than I expected (assignable_id). So I could populate both params using a single resource. Relevant code:

    @dlt.transformer(data_from=assignments, write_disposition="replace")
    def subtasks(assignments):
        @dlt.defer
        def _get_subtasks(_assignment):
            project_id = _assignment["assignable_id"]
            assignment_id = _assignment["id"]
            for page in client.paginate(
                path=f"projects/{project_id}/assignments/{assignment_id}/subtasks",
                params={"per_page": 250},
            ):
                yield page

        for _assignment in assignments:
            yield _get_subtasks(_assignment)

That might be a good v1 for multiple resolve params: You can declare multiple resolve params as long as they all come from the same resource. That way it should still be a single, straightforward transformer.

from verified-sources.

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.