include full sql statements

This commit is contained in:
Paul Trowbridge 2018-02-26 15:22:38 -05:00
parent b40f3edcda
commit cfab0746e7
2 changed files with 72 additions and 0 deletions

View File

@ -91,6 +91,51 @@ screen builds json
}
}
SQL
---------------------------------------
SELECT
jsonb_pretty(r.x)
FROM
tps.srce_set(
'DCARD',
$$
{
"name": "DCARD",
"type": "csv",
"schema": [
{
"key": "Trans. Date",
"type": "date"
},
{
"key": "Post Date",
"type": "date"
},
{
"key": "Description",
"type": "text"
},
{
"key": "Amount",
"type": "numeric"
},
{
"key": "Category",
"type": "text"
}
],
"unique_constraint": {
"type": "key",
"fields": [
"{Post Date}",
"{Trans. Date}",
"{Description}"
]
}
}
$$
) r(x)
backend handles SQL
-----------------------------------

View File

@ -77,6 +77,33 @@ map definition
"description": "pull first 20 characters from description for mapping"
}
SQL
---------------------------------------------
INSERT INTO
tps.map_rm
SELECT
'DCARD',
'First 20',
$$ {
"defn": [
{
"key": "{Description}",
"map": "y",
"flag": "g",
"field": "f20",
"regex": ".{1,20}",
"retain": "y"
}
],
"name": "First 20",
"where": [
{"Category":"Restaurantes"},
{"Category":"Services"}
],
"function": "extract",
"description": "pull first 20 characters from description for mapping"
} $$::jsonb,
1
assign new key/values to the results of the regular expression, and then back to the underlying row it came from