Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/demos/check-convert.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/sqlquack-logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/sqlquack-logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
231 changes: 145 additions & 86 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions website/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export default defineConfig({
},
favicon: '/favicon.png',
head: [
{ tag: 'meta', attrs: { property: 'og:image', content: 'https://sqlquack.io/assets/og-sqlquack.png' } },
{ tag: 'meta', attrs: { property: 'og:image', content: 'https://sqlquack.io/assets/og-sqlquack-v2.png' } },
{ tag: 'meta', attrs: { property: 'og:image:width', content: '1200' } },
{ tag: 'meta', attrs: { property: 'og:image:height', content: '630' } },
{ tag: 'meta', attrs: { property: 'og:image:alt', content: 'SQLQuack: a warehouse SQL compiler that translates to DuckDB, or refuses to guess.' } },
{ tag: 'meta', attrs: { name: 'twitter:image', content: 'https://sqlquack.io/assets/og-sqlquack.png' } },
{ tag: 'meta', attrs: { name: 'twitter:image', content: 'https://sqlquack.io/assets/og-sqlquack-v2.png' } },
],
social: [
{ icon: 'github', label: 'GitHub', href: 'https://github.com/sqlstack-io/sqlquack' },
Expand Down
4 changes: 2 additions & 2 deletions website/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<meta property="og:title" content="SQLQuack · Run warehouse SQL locally. Verified results, or a clear no" />
<meta property="og:description" content="A SQLGlot alternative in Rust that would rather reject your SQL than return the wrong answer." />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://sqlquack.io/assets/og-sqlquack.png" />
<meta property="og:image" content="https://sqlquack.io/assets/og-sqlquack-v2.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="SQLQuack: a warehouse SQL compiler that translates to DuckDB, or refuses to guess." />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://sqlquack.io/assets/og-sqlquack.png" />
<meta name="twitter:image" content="https://sqlquack.io/assets/og-sqlquack-v2.png" />
<link rel="icon" type="image/png" sizes="128x128" href="/favicon.png" />
<link rel="preload" href="/fonts/inter-latin-wght-normal.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="/styles.css" />
Expand Down
4 changes: 2 additions & 2 deletions website/public/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<meta property="og:title" content="SQLQuack Playground · Run warehouse SQL locally. Verified results, or a clear no" />
<meta property="og:description" content="A SQLGlot alternative in Rust that would rather reject your SQL than return the wrong answer." />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://sqlquack.io/assets/og-sqlquack.png" />
<meta property="og:image" content="https://sqlquack.io/assets/og-sqlquack-v2.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="SQLQuack: a warehouse SQL compiler that translates to DuckDB, or refuses to guess." />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://sqlquack.io/assets/og-sqlquack.png" />
<meta name="twitter:image" content="https://sqlquack.io/assets/og-sqlquack-v2.png" />
<link rel="icon" type="image/png" sizes="128x128" href="/favicon.png" />
<link rel="preload" href="/fonts/inter-latin-wght-normal.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="/styles.css" />
Expand Down
2 changes: 2 additions & 0 deletions website/recordings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scratch/
out/
33 changes: 33 additions & 0 deletions website/recordings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# CLI recordings

Terminal recordings of `sqlquack` for the README, rendered with
[VHS](https://github.com/charmbracelet/vhs) from the `.tape` scripts in `tapes/`. The tapes and
scripts are the source; the rendered GIF and PNG files go to `out/`, which is not committed.

| Demo | Shows |
|------|-------|
| `check-convert` | `sqlquack check` reports a QUALIFY clause Snowflake rejects, `sqlquack convert` converts a query to DuckDB SQL, and refuses one that needs `HASH`. |

The README uses `check-convert`, copied into `.github/demos/`.

## Requirements

- `vhs`, `ttyd` and `ffmpeg` on `PATH`, plus a Chromium or Chrome that VHS can find.
- DejaVu Sans Mono, the font the tapes use.
- `sqlquack` built with `cargo build --release -p sqlquack`, or `SQLQUACK_BIN` pointing at a
directory that contains the `sqlquack` to record. `record.sh` puts the DuckDB library the build
downloaded on the library path.

## Record

```bash
cd website/recordings
./record.sh check-convert # out/check-convert.gif and out/check-convert.png
cp out/check-convert.gif ../../.github/demos/
```

`record.sh` runs `prepare.sh <demo>` to write the demo's SQL and schema under `scratch/<demo>/`,
then renders `tapes/<demo>.tape`. Shared terminal settings and the colour theme are in
`tapes/common.tape`.

Look at every recording before publishing it.
46 changes: 46 additions & 0 deletions website/recordings/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Build the scratch directory for one demo. Usage: prepare.sh <demo>
set -euo pipefail
demo="$1"
here="$(cd "$(dirname "$0")" && pwd)"
dir="$here/scratch/$demo"
rm -rf "$dir"
mkdir -p "$dir"
cd "$dir"
case "$demo" in
check-convert)
# A query Snowflake rejects, one that converts, and one the built-in policy refuses.
cat > orders.sql <<'SQL'
SELECT customer_id, SUM(total) AS revenue
FROM orders
WHERE status = 'shipped'
GROUP BY customer_id
QUALIFY revenue > 100
SQL
cat > revenue.sql <<'SQL'
SELECT customer_id, SUM(total) AS revenue
FROM orders
WHERE status = 'shipped'
GROUP BY customer_id
HAVING SUM(total) > 100
SQL
cat > bucket.sql <<'SQL'
SELECT order_id,
HASH(customer_id) AS bucket
FROM orders
SQL
cat > schema.json <<'JSON'
{
"ORDERS": [
["ORDER_ID", "NUMBER(38,0)"],
["CUSTOMER_ID", "NUMBER(38,0)"],
["STATUS", "VARCHAR"],
["TOTAL", "NUMBER(12,2)"]
]
}
JSON
;;
*)
echo "unknown demo: $demo" >&2
exit 2 ;;
esac
18 changes: 18 additions & 0 deletions website/recordings/record.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Record one demo to out/<demo>.gif and out/<demo>.png. Usage: record.sh <demo>
# Uses target/release/sqlquack; set SQLQUACK_BIN to a directory containing another sqlquack to use that.
set -euo pipefail
demo="$1"
here="$(cd "$(dirname "$0")" && pwd)"
repo="$(cd "$here/../.." && pwd)"
bin="${SQLQUACK_BIN:-$repo/target/release}"
export PATH="$bin:$PATH"
# The binary links the DuckDB shared library the build downloads beside its profile directory.
lib="$(dirname "$(find "$bin/../duckdb-download" -name 'libduckdb.*' | sort | tail -1)")"
export LD_LIBRARY_PATH="$lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export DYLD_LIBRARY_PATH="$lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
"$here/prepare.sh" "$demo"
mkdir -p "$here/out"
cd "$here"
# Headless Chromium's sandbox is unavailable in many containers and CI runners.
VHS_NO_SANDBOX="${VHS_NO_SANDBOX:-true}" vhs "tapes/$demo.tape"
33 changes: 33 additions & 0 deletions website/recordings/tapes/check-convert.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Source tapes/common.tape
Set Height 600
Output out/check-convert.gif
Hide
Type "cd scratch/check-convert && export PS1='$ ' && clear"
Enter
Sleep 500ms
Show
Type "cat orders.sql"
Enter
Sleep 1500ms
Type "sqlquack check orders.sql"
Sleep 300ms
Enter
Wait@60s /\$\s*$/
Sleep 5s
Hide
Type "clear"
Enter
Sleep 300ms
Show
Type "sqlquack convert revenue.sql --schema schema.json"
Sleep 300ms
Enter
Wait@60s /\$\s*$/
Sleep 4s
Type "sqlquack convert bucket.sql --schema schema.json"
Sleep 300ms
Enter
Wait@60s /\$\s*$/
Sleep 1s
Screenshot out/check-convert.png
Sleep 5s
13 changes: 13 additions & 0 deletions website/recordings/tapes/common.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Set Shell bash
Set FontFamily "DejaVu Sans Mono"
Set FontSize 17
Set LineHeight 1.1
Set Width 1360
Set Height 680
Set Padding 28
Set Margin 24
Set MarginFill "#0d0f12"
Set BorderRadius 10
Set WindowBar Colorful
Set TypingSpeed 45ms
Set Theme { "name": "SQLQuack", "black": "#626975", "red": "#f47089", "green": "#54cf8e", "yellow": "#ffe000", "blue": "#4f98ee", "magenta": "#a78bfa", "cyan": "#1fe0c0", "white": "#c9cdd4", "brightBlack": "#9ba1ac", "brightRed": "#f47089", "brightGreen": "#54cf8e", "brightYellow": "#fff06a", "brightBlue": "#4f98ee", "brightMagenta": "#c79bf0", "brightCyan": "#1fe0c0", "brightWhite": "#e9ebef", "background": "#111418", "foreground": "#c9cdd4", "selection": "#2a2f37", "cursor": "#e9ebef" }
Loading