Skip to content

Instantly share code, notes, and snippets.

@kochie
Created May 21, 2019 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kochie/540ec2ca50e912d1dbfcb04ee83c7a93 to your computer and use it in GitHub Desktop.
Save kochie/540ec2ca50e912d1dbfcb04ee83c7a93 to your computer and use it in GitHub Desktop.
Athena script to convert csv to Neptune tables
SELECT CONCAT(CAST(m1.lid AS VARCHAR),
'-',CAST(m2.lid AS VARCHAR)) AS "id",
CONCAT(CAST(m1.pid AS VARCHAR),'-',CAST(m2.pid AS VARCHAR)) AS "~id",
m1.pid AS "~to", m2.pid AS "~from",
m1.quantity*m2.quantity AS "weight",
'boughtTogether' AS "~label"
FROM "mumumango"."lineitem" AS m1, "mumumango"."lineitem" AS m2
WHERE m1.lid<m2.lid
AND m1.oid=m2.oid
ORDER BY m1.lid;
SELECT mp.pid AS "~id",
mp."title" AS "~label",
mp.catid AS "catid",
mc.category AS "category"
FROM "mumumango"."product" as mp
JOIN "mumumango"."category" as mc
ON mp.catid=mc.catid
ORDER BY mp.pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment