Skip to content

Aggregation on keys #40

Description

@thomasborgen

I would guess that without aggregation possibilities on some key or set of keys that one would have to fall back to code when dealing with duplicated entries or need to handle unique values only.

What I believe Aggregation entails is for example a csv file like this:

customer_number;item;quantity
1;1;100
1;2;300
2;1;300

With the current state of kaiba one can only iterate over each line here and then create an object per line.

Having the possibility to aggregate on customer_number one would then be able to create 1 customer object per unique customer_number. I still think it makes the most sense to treat each aggregation as normal iterables where one will be able to create one item/quantity object per line. So something like this:

{
  "customers": [
    {
      "customer_id": 1,
      "items": [
        { "item_id": 1, "quantity" 100 },
        { "item_id": 2, "quantity" 300 },
      ]
    },
    {
      "customer_id": 2,
      "items": [
        { "item_id": 1, "quantity" 300 },
      ]
    }
  ]
}

Not exactly sure how the implementation would be done, but I'm quite sure it should be possible.

I also wonder if there are any reasons to have multiple aggregation_keys

I'll look into this if there's a need, or whenever i get time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions