get json doc storage to work

This commit is contained in:
Paul Trowbridge 2018-05-25 14:03:01 -04:00
parent 0196ba4c53
commit 053ddb0c9e
3 changed files with 70 additions and 31 deletions

View File

@ -1,29 +1,31 @@
{ [
"id": 1, {
"doc": { "id": 1,
"rows": [ "doc": {
{ "rows": [
"elements": [ {
{ "elements": [
"status": "OK", {
"distance": { "status": "OK",
"text": "225 mi", "distance": {
"value": 361940 "text": "225 mi",
}, "value": 361940
"duration": { },
"text": "3 hours 50 mins", "duration": {
"value": 13812 "text": "3 hours 50 mins",
"value": 13812
}
} }
} ]
] }
} ],
], "status": "OK",
"status": "OK", "origin_addresses": [
"origin_addresses": [ "Washington, DC, USA"
"Washington, DC, USA" ],
], "destination_addresses": [
"destination_addresses": [ "New York, NY, USA"
"New York, NY, USA" ]
] }
} }
} ]

View File

@ -0,0 +1,37 @@
SELECT
*
FROM
tps.srce_import(
'DMAPI'
,$$
[{
"id": 1,
"doc": {
"rows": [
{
"elements": [
{
"status": "OK",
"distance": {
"text": "225 mi",
"value": 361940
},
"duration": {
"text": "3 hours 50 mins",
"value": 13812
}
}
]
}
],
"status": "OK",
"origin_addresses": [
"Washington, DC, USA"
],
"destination_addresses": [
"New York, NY, USA"
]
}
}]
$$::JSONB
)

View File

@ -28,11 +28,11 @@ FROM
"type": "numeric", "type": "numeric",
"column_name": "duration" "column_name": "duration"
} }
],
"constraint": [
"{doc}"
] ]
} },
"constraint": [
"{doc}"
]
} }
$$ $$
) r(x); ) r(x);