From aa38edcab665f7604e5f09b65d33156dbc78a3c2 Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Wed, 9 Aug 2023 03:06:37 +0100 Subject: Add shellscripts for processing --- import.bash | 9 +++++++++ upload.bash | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100644 import.bash create mode 100644 upload.bash diff --git a/import.bash b/import.bash new file mode 100644 index 0000000..33e83b6 --- /dev/null +++ b/import.bash @@ -0,0 +1,9 @@ +#!/bin/bash + +export name=$1 + +dolt table rm $name +dolt schema import -c --pks id $name $name.csv --dry-run > /tmp/dolt_tmp_query.sql +$EDITOR /tmp/dolt_tmp_query.sql +dolt sql < /tmp/dolt_tmp_query.sql +dolt table import -u $name $name.csv diff --git a/upload.bash b/upload.bash new file mode 100644 index 0000000..59f067d --- /dev/null +++ b/upload.bash @@ -0,0 +1,6 @@ +#!/bin/bash + +rm *.txt *.csv +unzip $1 + +for file in *.txt; do mv $file ${file%.txt}.csv; echo $file; bash import.bash ${file%.txt} ; done -- cgit v1.2.3-70-g09d2