update readme, shell fixes from pycharm, comment last_sync funcs
authorgamesguru <mathmuncher11@gmail.com>
Mon, 31 May 2021 19:48:51 +0000 (15:48 -0400)
committergamesguru <mathmuncher11@gmail.com>
Mon, 31 May 2021 19:55:20 +0000 (15:55 -0400)
README.rst
sql/__init__.py
sql/export.sh
sql/format.sh
sql/functions.sql

index 0eedc76ece125c5de8f65b2c90f2529852794d44..dbe4c8f7811c37e39416b1ae82709cec746369ad 100644 (file)
@@ -18,8 +18,7 @@ Building the database
 
 .. code-block:: bash
 
-    cd sql
-    bash build.sh
+    python build.py
 
 3. Verify the tables (again inside the SQL shell :code:`sqlite nutra.db`),
 
index 77776ac6ac233b1b07ed849dbd4566e0823fc1bd..f2568260d112824da59c25b8317e929f97ffa996 100644 (file)
@@ -5,7 +5,6 @@ import csv
 import os
 import sqlite3
 
-# TODO: defined-twice, from ntclient import NT_DB_NAME
 NT_DB_NAME = "nt.sqlite"
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
 
index 627d8d8892ab1c832b0a8c9eede4bca0f56f5352..7cd49c957705776de436a240d7416bb74ae48e0e 100755 (executable)
@@ -3,12 +3,13 @@
 cd "$(dirname "$0")"
 
 table_cmd="sqlite3 nt.sqlite '.tables'"
-tables=`sqlite3 nt.sqlite '.tables'`
+tables=$(bash -exec "$table_cmd")
+echo "$tables"
 
 for t in $tables
 do
     export_cmd="SELECT * FROM $t"
-    echo $export_cmd
+    echo "\"$export_cmd\""
     export_cmd="sqlite3 -csv nt.sqlite "\"$export_cmd\"""
     bash -exec "$export_cmd" > "data/$t.csv"
 done
index 0c90d08ef8d79f7fb43260f36f0c47833991be66..47de6844ea1f75ab80693dde2a41d5d5f93596cf 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
 
 cd "$(dirname "$0")"
 
index 5574dd369e7a24fe7fb09cac72d852617824a33a..dda9dbcbb8bb6f72821e5d4ae7f046386ac6ea14 100644 (file)
@@ -170,18 +170,18 @@ GROUP BY
 -- Last sync
 --------------------------------
 
-SELECT
-  max((
-    SELECT
-      last_sync FROM profiles), (
-    SELECT
-      last_sync FROM biometric_log), (
-    SELECT
-      last_sync FROM recipes), (
-    SELECT
-      last_sync FROM food_log), (
-    SELECT
-      last_sync FROM recipe_log), (
-    SELECT
-      last_sync FROM rda)) AS last_sync;
+-- SELECT
+--   max((
+--     SELECT
+--       last_sync FROM profiles), (
+--     SELECT
+--       last_sync FROM biometric_log), (
+--     SELECT
+--       last_sync FROM recipes), (
+--     SELECT
+--       last_sync FROM food_log), (
+--     SELECT
+--       last_sync FROM recipe_log), (
+--     SELECT
+--       last_sync FROM rda)) AS last_sync;