Created
May 21, 2019 01:33
-
-
Save kochie/540ec2ca50e912d1dbfcb04ee83c7a93 to your computer and use it in GitHub Desktop.
Athena script to convert csv to Neptune tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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