Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Appending into Embedded structure #5

Open
Abhisrajput opened this issue Sep 26, 2018 · 4 comments
Open

Support Appending into Embedded structure #5

Abhisrajput opened this issue Sep 26, 2018 · 4 comments

Comments

@Abhisrajput
Copy link

Hi,

Your work is awesome, I was wondering if you can add a support to append inside the embedded structure

For example:
In the below data set if first two rows are same then have only one document and embed them into one.

name,age (years),weight (kg),birth day,birth month,birth year,adopted,adopted_since
Tommy,5,3.6,11,April,2011,TRUE,2012
Tommy,5,3.6,12,May,2012,TRUE,2012
Clara,2,8.2,6,May,2015,FALSE,N/A
Catnip,6,3.3,21,August,2011,TRUE,2017
Ciel,3,3.1,18,January,2015,TRUE,2018

Output:

[
    {
        "adopted_since": "2012",
        "weight (kg)": "3.6",
        "birth": [{
            "year": "2011",
            "day": "11",
            "month": "April"
        },{
            "year": "2012",
            "day": "12",
            "month": "April"
        }],
        "age (years)": "5",
        "name": "Tommy",
        "adopted": "TRUE"
    },
    {
        "adopted_since": "N/A",
        "weight (kg)": "8.2",
        "birth": {
            "year": "2015",
            "day": "6",
            "month": "May"
        },
        "age (years)": "2",
        "name": "Clara",
        "adopted": "FALSE"
    },
    {
        "adopted_since": "2017",
        "weight (kg)": "3.3",
        "birth": {
            "year": "2011",
            "day": "21",
            "month": "August"
        },
        "age (years)": "6",
        "name": "Catnip",
        "adopted": "TRUE"
    },
    {
        "adopted_since": "2018",
        "weight (kg)": "3.1",
        "birth": {
            "year": "2015",
            "day": "18",
            "month": "January"
        },
        "age (years)": "3",
        "name": "Ciel",
        "adopted": "TRUE"
    }
]
@chamkank
Copy link
Owner

Hey, thanks for reaching out! That's an interesting idea, but can I ask what your use case for this would be? This seems like it would have better compression, at the cost of making the schema more complicated.

@Abhisrajput
Copy link
Author

Let's say, I am having web portal from where status of few fields changes a couple of time in a day. And at the end of the day I am processing the file and storing in the way I showed you in the above example rather that having a new document. It will definitely save some space.

Just thinking if it's possible.

Thanks

@rossw7
Copy link

rossw7 commented Dec 18, 2018

I agree your work is amazing! Helped me so much.

I do need embedded list/array support also.

Example:

"Resources": [
{
"Type": "AwsEc2Instance",
"Id": "i-cafebabe",
"Partition": "aws",
"Region": "us-west-2",
"Tags": {
"billingCode": "Lotus-1-2-3",
"needsPatching": "true"
},
"Details": {
"AwsEc2Instance": {
"Type": "i3.xlarge",
"ImageId": "ami-abcd1234",
"IpV4Addresses": [ "54.194.252.215", "192.168.1.88" ],
"IpV6Addresses": [ "2001:db8:1234:1a2b::123" ],
"KeyName": "my_keypair",
"VpcId": "vpc-11112222",
"SubnetId": "subnet-56f5f633",
"LaunchedAt": "2018-05-08T16:46:19.000Z"
}
}
}
]

@ganeshpitchai
Copy link

I need the structure like above, how to mention for the array object[] in the file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants