Skip to content

Have split_key still be present in the record #7

@justchris1

Description

@justchris1

First - thanks for this module. It has been quite useful.

I was wondering if there was an option for when the record was split, if the original record field could be preserved? To be more specific, I have a record that looks like this:

{
    "key1": "data1",
    "key2": "data2",
    "key3": {
        "key4": "data4",
        "key5": "data5"
    },
    "items": [ 
                {
                  "key6": "data6",
                  "key7": "data7"
                }, 
                {
                  "key8": "data8",
                  "key9": "data9",
                  "key10": "data10"
                }
            ],
    "key11": "data11"
}

A few notes: The elements inside the 'items' key are dictionaries, and do not neccessarily have the same keys (or even number of keys) inside them. They may or may not be overlap in the keys between dictionaries. In this example, they do not, but there is nothing stopping 'key6' also being present in the key8-10 dictionary with the same or different value than 'data6'.

I am trying to split_key on 'items'. If I do so, then I think this is the result (with keep_other_key true):

{
    "key1": "data1",
    "key2": "data2",
    "key3": {
        "key4": "data4",
        "key5": "data5"
    },
   "key6": "data6",
   "key7": "data7",
    "key11": "data11"
},
{
    "key1": "data1",
    "key2": "data2",
    "key3": {
        "key4": "data4",
        "key5": "data5"
    },
     "key8": "data8",
     "key9": "data9",
     "key10": "data10",
    "key11": "data11"
}

However, it totally removed all reference to 'items'. Ideally, I would just swap that to a dictionary (which now only has one 'entry'), like so:

{
    "key1": "data1",
    "key2": "data2",
    "key3": {
        "key4": "data4",
        "key5": "data5"
    },
    "items": {
                  "key6": "data6",
                  "key7": "data7"
                }, 
    "key11": "data11"
},
{
    "key1": "data1",
    "key2": "data2",
    "key3": {
        "key4": "data4",
        "key5": "data5"
    },
    "items": {
                  "key8": "data8",
                  "key9": "data9",
                  "key10": "data10"
                },
    "key11": "data11"
}

Do you have any suggestion on how I might do that or some way of enhancing this module to support that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions