nowfound

Work · July 7, 2021

SQ

SQLite query inside a Bash function

Part of the workflow for building my website is the generation of a table in tab-separated column format (.tsv). The source data is found in four other .tsv files. I use an SQLite query to perform a 4-way join and write out the new table. For convenience, I wrote a script that encapsulates the query inside a Bash function. The example below illustrates this technique. repertoire() { pushd $CMM_SOURCES&#x2F;_data sqlite3 <<EOS .headers on .mode tabs .import category.tsv category .import composition.tsv composition .import concert.tsv concert .import program.tsv program .once repertoire.tsv…

What it does

In the maker’s words, at launch

Part of the workflow for building my website is the generation of a table in tab-separated column format (.tsv). The source data is found in four other .tsv files. I use an SQLite query to perform a 4-way join and write out the new table. For convenience, I wrote a script that encapsulates the query inside a Bash function. The example below illustrates this technique. repertoire() { pushd $CMM_SOURCES&#x2F;_data sqlite3 <<EOS .headers on .mode tabs .import category.tsv category .import composition.tsv composition .import concert.tsv concert .import program.tsv program .once repertoire.tsv SELECT category.name AS category, composition.key, composition.composer, composition.name AS composition, concert.name AS concert FROM category, concert, composition, program WHERE julianday(concert.date) < julianday('now') AND composition.category = category.name AND program.key = composition.key AND program.date = concert.date ORDER BY category.sequence, composition.key ; EOS popd }

Does the same job

all alternatives →
  • SQL Workbench2024 · ▲186

    In-browser SQL Workbench for data querying & visualization

  • ClaySQL2021 · ▲141

    Run SQL queries directly in Google Sheets

  • TABLUM.IO2023 · ▲159

    Turn CSV, XML & JSON into a live analysis-ready SQL database

  • SS
    SPyQL – SQL with Python in the middle2022 · github.com · ▲105

    SPyQL (https:&#x2F;&#x2F;github.com&#x2F;dcmoura&#x2F;spyql) is SQL with Python in the middle, an open-source project fully written in Python for making command-line data processing more intuitive, readable and powerful. Try mixing in the same pot: a SQL SELECT for providing the structure, Python expressions for defining transformations and conditions, the essence of awk as a data-processing language, and the JSON handling capabilities of jq. How does a SPyQL query looks like? $ spyql “ IMPORT pendulum AS p SELECT (p.now() - p.from_timestamp(purchase_ts)).in_days() AS days_ago, sum_agg(price…

  • SS
  • SV

More work this month

the category →
  • Let agents source clips from terabytes of your local video

    Work · 18d ago · clipto.com

  • Free local transcription that is 100% Private

    Work · 17d ago · hynote.ai

  • The app store for voice native apps that lives in your notch

    Work · 28d ago · voiceos.com

  • Ask any question, get a video back instantly

    Work · 24d ago · scrimba.com

  • Handle all of the work before, during, and after meetings

    Work · 17d ago · calendly.com

Launched alongside, July 2021

the whole month →