Flattened Documents Model

Gravity returns a single table representing a JOIN of the available documents in the file. Additionally, nested sibling values (child paths at the same height), will be treated as a CROSS JOIN.

Example Raw Data:

{
  "people": [
    {
      "personal": {
        "age": 20,
        "gender": "M",
        "name": {
          "first": "John",
          "last": "Doe"
        }
      },
      "vehicles": [
        {
          "type": "car",
          "model": "Honda Civic",
          "insurance": {
            "company": "ABC Insurance",
            "policy_num": "12345"
          },
          "maintenance": [
            {
              "date": "07-17-2017",
              "desc": "oil change"
            },
            {
              "date": "01-03-2018",
              "desc": "new tires"
            }
          ]
        },
        {
          "type": "truck",
          "model": "Dodge Ram",
          "insurance": {
            "company": "ABC Insurance",
            "policy_num": "12345"
          },
          "maintenance": [
            {
              "date": "08-27-2017",
              "desc": "new tires"
            },
            {
              "date": "01-08-2018",
              "desc": "oil change"
            }
          ]
        }
      ],
      "source": "internet"
    },
    {
      "personal": {
        "age": 24,
        "gender": "F",
        "name": {
          "first": "Jane",
          "last": "Roberts"
        }
      },
      "vehicles": [
        {
          "type": "car",
          "model": "Toyota Camry",
          "insurance": {
            "company": "Car Insurance",
            "policy_num": "98765"
          },
          "maintenance": [
            {
              "date": "05-11-2017",
              "desc": "tires rotated"
            },
            {
              "date": "11-03-2017",
              "desc": "oil change"
            }
          ]
        },
        {
          "type": "car",
          "model": "Honda Accord",
          "insurance": {
            "company": "Car Insurance",
            "policy_num": "98765"
          },
          "maintenance": [
            {
              "date": "10-07-2017",
              "desc": "new air filter"
            },
            {
              "date": "01-13-2018",
              "desc": "new brakes"
            }
          ]
        }
      ],
      "source": "phone"
    }
  ]
}

Example Flattened Documents

agegenderfirst_namelast_namesourcetypemodelins_companyins_policy_nummaint_datemaint_desc

20

M

John

Doe

internet

car

Honda Civic

ABC Insurance

12345

2017-07-17

oil change

20

M

John

Doe

internet

car

Honda Civic

ABC Insurance

12345

2018-01-03

new tires

20

M

John

Doe

internet

truck

Dodge Ram

ABC Insurance

12345

2017-08-27

new tires

20

M

John

Doe

internet

truck

Dodge Ram

ABC Insurance

12345

2018-01-08

oil change

24

F

Jane

Roberts

phone

car

Toyota Camry

Car Insurance

98765

2017-05-11

tires rotated

24

F

Jane

Roberts

phone

car

Toyota Camry

Car Insurance

98765

2017-11-03

oil change

24

F

Jane

Roberts

phone

car

Honda Accord

Car Insurance

98765

2017-10-07

new air filter

24

F

Jane