Trying out Common Table Expressions feature in CB 6.5 Beta. Are only SELECT statements allowed as the consumer of CTEs? This works… (yay!)
WITH transform AS (
WITH extract AS (
SELECT y keyTransactions
FROM CURL(“http://api.newrelic.com/v2/key_transactions.json",{"header”: “X-Api-Key: b1adeeb1adeeb1a”}) x
UNNEST x.key_transactions as y
)
SELECT e.keyTransactions.id id,
e.keyTransactions.application_summary appSummary
FROM extract e
)
SELECT t.id, t.appSummary FROM transform t
But if the target of the CTEs are an INSERT, error (boo!). Complains about INSERT:
WITH transform AS (
WITH extract AS (
SELECT y keyTransactions
FROM CURL(“http://api.newrelic.com/v2/key_transactions.json",{"header”: “X-Api-Key:b1adeeb1adeeb1a”}) x
UNNEST x.key_transactions as y
)
SELECT e.keyTransactions.id id,
e.keyTransactions.application_summary appSummary
FROM extract e
)
INSERT INTO test (i,a) SELECT t.id i, t.appSummary a FROM transform t
“code”: 3000,
“msg”: “syntax error - at INSERT”,…
Only replaced the ultimate SELECT with an INSERT…SELECT
Is it planned for release? One liner ETL would be cool. (It can be accomplished without the CTEs, but use of CTEs makes it much more readable.
-MK
P.S. is there a (more) proper forum or tag for 6.5 Beta questions?