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,3 +1,4 @@
[
{ {
"id": 1, "id": 1,
"doc": { "doc": {
@ -27,3 +28,4 @@
] ]
} }
} }
]

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": [ "constraint": [
"{doc}" "{doc}"
] ]
} }
}
$$ $$
) r(x); ) r(x);