Devops Run SQL

Table of Contents

1. When to use this skill

Running SQL in the environment — queries or scripts, with credentials and connection from .env.

2. How to use this skill

  1. Know which database you are about to touch. The connection comes from this worktree's .env, so the same command hits a different database in another worktree. Check compass where if unsure.
  2. Run the query through the recipe below, which supplies the credentials and connection rather than having you retype them.
  3. Prefer a read before a write. A SELECT that returns the rows a DELETE would remove costs one command and prevents the mistake that needs a database rebuild.

3. Recipes

4. Reference

  • ores.compass — the tool every one of these commands runs through.

Emacs 29.3 (Org mode 9.6.15)