Created
October 30, 2022 13:23
-
-
Save lauri-kaariainen/0d46c498dbbc4f84f4c0af99e92fbfb9 to your computer and use it in GitHub Desktop.
sqlite3 line to create json list from read fineli csv
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
sqlite3 -json build/fineli.db "SELECT | |
cv.food_id, | |
GROUP_CONCAT(cv.value) AS Valuelist, | |
GROUP_CONCAT(c.description) AS Desclist, | |
f.name AS name | |
FROM component_value cv | |
JOIN food f ON f.id = cv.food_id | |
INNER JOIN components c ON c.id = cv.component_id | |
JOIN units u ON u.id = c.unit_id | |
JOIN component_class cc ON cc.id = c.component_class_id | |
JOIN component_class cc2 ON cc2.id = c.component_superclass_id | |
JOIN sources s ON s.id = cv.source_id | |
JOIN methods m ON m.id = cv.method_id | |
WHERE (c.id == 4 OR c.id == 6 OR c.id == 17 OR c.id == 37) | |
GROUP BY cv.food_id" > foods.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iconv -f iso-8859-1 -t utf-8 foods.json > foodsutf8.json