test and modify building of view to be based on allj
This commit is contained in:
parent
cdba942e9e
commit
39820d6051
@ -1,4 +1,4 @@
|
|||||||
CREATE FUNCTION tps.build_srce_view_sql(_srce text, _schema text) RETURNS TEXT
|
CREATE OR REPLACE FUNCTION tps.build_srce_view_sql(_srce text, _schema text) RETURNS TEXT
|
||||||
AS
|
AS
|
||||||
$f$
|
$f$
|
||||||
DECLARE
|
DECLARE
|
||||||
@ -11,7 +11,7 @@ BEGIN
|
|||||||
_path:= ARRAY['schemas',_schema]::text[];
|
_path:= ARRAY['schemas',_schema]::text[];
|
||||||
--_srce:= 'dcard';
|
--_srce:= 'dcard';
|
||||||
SELECT
|
SELECT
|
||||||
'CREATE VIEW tpsv.'||_srce||'_'||_path[2]||' AS SELECT '||string_agg('(rec#>>'''||r.PATH::text||''')::'||r.type||' AS "'||r.column_name||'"',', ')||' FROM tps.trans WHERE srce = '''||_srce||''''
|
'CREATE VIEW tpsv.'||_srce||'_'||_path[2]||' AS SELECT '||string_agg('(allj#>>'''||r.PATH::text||''')::'||r.type||' AS "'||r.column_name||'"',', ')||' FROM tps.trans WHERE srce = '''||_srce||''''
|
||||||
INTO
|
INTO
|
||||||
_sql
|
_sql
|
||||||
FROM
|
FROM
|
||||||
|
@ -35,6 +35,42 @@
|
|||||||
"column_name":"Category"
|
"column_name":"Category"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version2":[]
|
"mapped":[
|
||||||
|
{
|
||||||
|
"path":"{Trans. Date}",
|
||||||
|
"type":"date",
|
||||||
|
"column_name":"Trans. Date"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"{Post Date}",
|
||||||
|
"type":"date",
|
||||||
|
"column_name":"Post Date"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"{Description}",
|
||||||
|
"type":"text",
|
||||||
|
"column_name":"Description"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"{Amount}",
|
||||||
|
"type":"numeric",
|
||||||
|
"column_name":"Amount"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"{Category}",
|
||||||
|
"type":"text",
|
||||||
|
"column_name":"Category"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"{party}",
|
||||||
|
"type":"text",
|
||||||
|
"column_name":"Party"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"{reason}",
|
||||||
|
"type":"text",
|
||||||
|
"column_name":"Reason"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user