QR Codes functions in the Textplot DuckDB extension
Function category
QR Codes
1 functionEncode strings as QR codes rendered as Unicode-block art. Useful for dashboards, terminal output, and embedding scannable links in docs.
Signature
tp_qr(
value: VARCHAR,
ecc := VARCHAR = 'low',
off := VARCHAR = '⬜',
on := VARCHAR = '⬛'
) → VARCHAR
Arguments
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
value
|
Type
VARCHAR
|
Mode Positional | Description String value to encode. |
Argument
ecc
|
Type
VARCHAR
|
Mode Named | Description Default: 'low' Error correction level: 'low', 'medium', 'quartile', or 'high'. Higher levels can survive more damage at the cost of larger QR codes. |
Argument
on
|
Type
VARCHAR
|
Mode Named |
Description
Default: '⬛'
Character for filled modules. Must be quoted as "on" (reserved keyword).
|
Argument
off
|
Type
VARCHAR
|
Mode Named |
Description
Default: '⬜'
Character for empty modules. Must be quoted as "off".
|
Description
Encode a string as a QR code rendered with Unicode block characters. Configurable error-correction level and custom on/off characters for styling.
1
Basic QR code
SELECT tp_qr('Hello, World!');
Output
| tp_qr('Hello, World!') |
|---|
⬛⬛⬛⬛⬛⬛⬛⬜⬛⬜⬜⬛⬜⬜⬛⬛⬛⬛⬛⬛⬛ ⬛⬜⬜⬜⬜⬜⬛⬜⬛⬛⬜⬜⬜⬜⬛⬜⬜⬜⬜⬜⬛ ⬛⬜⬛⬛⬛⬜⬛⬜⬜⬛⬜⬛⬜⬜⬛⬜⬛⬛⬛⬜⬛ ⬛⬜⬛⬛⬛⬜⬛⬜⬛⬛⬜⬛⬜⬜⬛⬜⬛⬛⬛⬜⬛ ⬛⬜⬛⬛⬛⬜⬛⬜⬜⬛⬛⬛⬜⬜⬛⬜⬛⬛⬛⬜⬛ ⬛⬜⬜⬜⬜⬜⬛⬜⬜⬛⬜⬛⬛⬜⬛⬜⬜⬜⬜⬜⬛ ⬛⬛⬛⬛⬛⬛⬛⬜⬛⬜⬛⬜⬛⬜⬛⬛⬛⬛⬛⬛⬛ ⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜ ⬛⬜⬛⬛⬜⬛⬛⬛⬜⬛⬜⬛⬛⬜⬛⬜⬜⬛⬜⬛⬛ ⬜⬜⬛⬜⬛⬛⬜⬛⬛⬛⬜⬜⬛⬛⬜⬜⬜⬛⬛⬜⬛ ⬛⬛⬜⬜⬛⬜⬛⬜⬜⬛⬛⬛⬜⬛⬜⬛⬜⬜⬜⬛⬛ ⬛⬜⬛⬜⬜⬜⬜⬜⬛⬛⬛⬛⬜⬜⬜⬜⬛⬛⬜⬛⬜ ⬛⬜⬛⬛⬜⬛⬛⬜⬜⬜⬛⬜⬛⬜⬛⬛⬜⬜⬜⬜⬛ ⬜⬜⬜⬜⬜⬜⬜⬜⬛⬜⬛⬛⬛⬛⬜⬜⬛⬜⬛⬜⬛ ⬛⬛⬛⬛⬛⬛⬛⬜⬛⬛⬛⬜⬜⬜⬛⬜⬛⬜⬜⬜⬜ ⬛⬜⬜⬜⬜⬜⬛⬜⬛⬛⬛⬜⬛⬛⬜⬛⬜⬛⬛⬛⬜ ⬛⬜⬛⬛⬛⬜⬛⬜⬜⬛⬛⬜⬜⬛⬜⬛⬛⬛⬛⬛⬜ ⬛⬜⬛⬛⬛⬜⬛⬜⬛⬜⬜⬜⬛⬛⬜⬜⬜⬛⬛⬛⬜ ⬛⬜⬛⬛⬛⬜⬛⬜⬛⬜⬜⬛⬛⬜⬛⬛⬜⬜⬛⬜⬜ ⬛⬜⬜⬜⬜⬜⬛⬜⬜⬜⬛⬛⬜⬛⬛⬛⬛⬜⬜⬜⬛ ⬛⬛⬛⬛⬛⬛⬛⬜⬛⬜⬛⬛⬛⬛⬛⬛⬜⬜⬛⬜⬜ |
2
High error correction (more redundancy, larger code)
SELECT tp_qr('https://query.farm', ecc := 'high');
Output
| tp_qr('https://query.farm', ecc := 'high') |
|---|
⬛⬛⬛⬛⬛⬛⬛⬜⬛⬜⬛⬜⬛⬜⬛⬜⬜⬜⬛⬜⬛⬜⬛⬛⬛⬛⬛⬛⬛ ⬛⬜⬜⬜⬜⬜⬛⬜⬛⬜⬜⬜⬛⬜⬛⬜⬛⬜⬜⬛⬜⬜⬛⬜⬜⬜⬜⬜⬛ ⬛⬜⬛⬛⬛⬜⬛⬜⬛⬛⬛⬛⬛⬛⬜⬛⬛⬜⬜⬛⬛⬜⬛⬜⬛⬛⬛⬜⬛ ⬛⬜⬛⬛⬛⬜⬛⬜⬜⬜⬜⬛⬛⬛⬜⬜⬛⬛⬜⬛⬜⬜⬛⬜⬛⬛⬛⬜⬛ ⬛⬜⬛⬛⬛⬜⬛⬜⬜⬜⬛⬛⬛⬛⬛⬛⬜⬜⬜⬛⬛⬜⬛⬜⬛⬛⬛⬜⬛ ⬛⬜⬜⬜⬜⬜⬛⬜⬛⬜⬜⬛⬜⬜⬛⬜⬛⬜⬛⬜⬛⬜⬛⬜⬜⬜⬜⬜⬛ ⬛⬛⬛⬛⬛⬛⬛⬜⬛⬜⬛⬜⬛⬜⬛⬜⬛⬜⬛⬜⬛⬜⬛⬛⬛⬛⬛⬛⬛ ⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜⬛⬜⬛⬛⬛⬛⬜⬜⬜⬛⬜⬜⬜⬜⬜⬜⬜⬜ ⬜⬜⬛⬛⬛⬜⬛⬜⬛⬛⬛⬛⬜⬜⬛⬛⬛⬜⬛⬜⬛⬛⬛⬛⬜⬜⬛⬛⬛ ⬛⬛⬛⬛⬜⬛⬜⬛⬜⬛⬛⬛⬜⬛⬜⬛⬜⬜⬜⬜⬜⬛⬜⬜⬛⬛⬛⬜⬛ ⬛⬛⬛⬜⬜⬛⬛⬛⬛⬜⬜⬛⬜⬜⬛⬜⬛⬛⬛⬜⬛⬛⬛⬛⬛⬜⬛⬜⬜ ⬛⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜⬛⬜⬛⬜⬜⬜⬜⬜⬜⬜⬛⬛⬛⬜⬛⬜⬛⬜ ⬜⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬛⬛⬛⬛⬛⬜⬜⬛⬜⬛⬛⬜⬛⬜⬜⬛⬛⬛ ⬛⬜⬛⬜⬛⬛⬜⬜⬜⬜⬜⬜⬛⬛⬛⬜⬛⬛⬜⬛⬛⬛⬛⬜⬛⬛⬜⬛⬛ ⬜⬜⬜⬛⬜⬜⬛⬜⬛⬛⬜⬛⬛⬜⬜⬜⬛⬜⬜⬜⬛⬜⬛⬛⬜⬜⬜⬛⬜ ⬜⬜⬛⬜⬜⬛⬜⬜⬛⬜⬛⬛⬜⬜⬛⬛⬛⬜⬛⬜⬜⬛⬛⬜⬛⬛⬜⬜⬜ ⬜⬛⬜⬜⬛⬛⬛⬛⬜⬜⬜⬜⬛⬜⬜⬜⬜⬛⬛⬜⬜⬜⬛⬜⬜⬛⬛⬛⬛ ⬛⬛⬛⬜⬜⬛⬜⬛⬛⬜⬛⬜⬜⬜⬛⬛⬜⬛⬜⬜⬛⬛⬜⬛⬛⬛⬜⬛⬛ ⬛⬜⬜⬛⬜⬛⬛⬛⬜⬜⬛⬛⬜⬜⬜⬛⬛⬜⬛⬛⬜⬜⬛⬜⬜⬜⬛⬜⬜ ⬛⬜⬛⬜⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬛⬛⬜⬛⬜⬛⬛⬜⬛⬛ ⬛⬜⬛⬛⬜⬛⬛⬜⬜⬜⬛⬜⬛⬛⬜⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬜⬛⬛⬜ ⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜⬜⬛⬜⬜⬜⬛⬛⬛⬛⬛⬜⬜⬜⬛⬛⬜⬜⬛ ⬛⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜⬜⬛⬜⬜⬜⬛⬛⬛⬜⬛⬜⬛⬜⬜⬜⬜ ⬛⬜⬜⬜⬜⬜⬛⬜⬜⬛⬜⬜⬛⬜⬛⬛⬛⬛⬜⬛⬛⬜⬜⬜⬛⬛⬜⬛⬛ ⬛⬜⬛⬛⬛⬜⬛⬜⬛⬛⬛⬛⬜⬛⬜⬛⬜⬛⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬜ ⬛⬜⬛⬛⬛⬜⬛⬜⬛⬛⬜⬛⬜⬛⬛⬜⬛⬛⬛⬛⬛⬛⬜⬛⬜⬜⬜⬜⬜ ⬛⬜⬛⬛⬛⬜⬛⬜⬛⬛⬜⬜⬜⬜⬛⬛⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬜⬛⬜ ⬛⬜⬜⬜⬜⬜⬛⬜⬜⬜⬜⬜⬛⬛⬜⬛⬛⬜⬛⬛⬜⬛⬜⬜⬛⬛⬜⬛⬜ ⬛⬛⬛⬛⬛⬛⬛⬜⬜⬛⬛⬜⬛⬛⬜⬜⬛⬛⬜⬜⬜⬜⬜⬜⬛⬛⬛⬜⬜ |
3
Custom emoji styling
SELECT tp_qr('https://query.farm', ecc := 'high', "on" := '🟡', "off" := '⚫');
Output
| tp_qr('https://query.farm', ecc := 'high', "on" := '🟡', "off" := '⚫') |
|---|
🟡🟡🟡🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫⚫⚫🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡🟡 🟡⚫⚫⚫⚫⚫🟡⚫🟡⚫⚫⚫🟡⚫🟡⚫🟡⚫⚫🟡⚫⚫🟡⚫⚫⚫⚫⚫🟡 🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡⚫🟡🟡⚫⚫🟡🟡⚫🟡⚫🟡🟡🟡⚫🟡 🟡⚫🟡🟡🟡⚫🟡⚫⚫⚫⚫🟡🟡🟡⚫⚫🟡🟡⚫🟡⚫⚫🟡⚫🟡🟡🟡⚫🟡 🟡⚫🟡🟡🟡⚫🟡⚫⚫⚫🟡🟡🟡🟡🟡🟡⚫⚫⚫🟡🟡⚫🟡⚫🟡🟡🟡⚫🟡 🟡⚫⚫⚫⚫⚫🟡⚫🟡⚫⚫🟡⚫⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫⚫⚫⚫⚫🟡 🟡🟡🟡🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡🟡 ⚫⚫⚫⚫⚫⚫⚫⚫🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫⚫⚫🟡⚫⚫⚫⚫⚫⚫⚫⚫ ⚫⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫⚫🟡🟡🟡 🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡🟡🟡⚫🟡⚫🟡⚫⚫⚫⚫⚫🟡⚫⚫🟡🟡🟡⚫🟡 🟡🟡🟡⚫⚫🟡🟡🟡🟡⚫⚫🟡⚫⚫🟡⚫🟡🟡🟡⚫🟡🟡🟡🟡🟡⚫🟡⚫⚫ 🟡⚫⚫⚫⚫⚫⚫⚫🟡🟡⚫🟡⚫🟡⚫⚫⚫⚫⚫⚫⚫🟡🟡🟡⚫🟡⚫🟡⚫ ⚫🟡🟡🟡🟡🟡🟡⚫⚫⚫⚫🟡🟡🟡🟡🟡⚫⚫🟡⚫🟡🟡⚫🟡⚫⚫🟡🟡🟡 🟡⚫🟡⚫🟡🟡⚫⚫⚫⚫⚫⚫🟡🟡🟡⚫🟡🟡⚫🟡🟡🟡🟡⚫🟡🟡⚫🟡🟡 ⚫⚫⚫🟡⚫⚫🟡⚫🟡🟡⚫🟡🟡⚫⚫⚫🟡⚫⚫⚫🟡⚫🟡🟡⚫⚫⚫🟡⚫ ⚫⚫🟡⚫⚫🟡⚫⚫🟡⚫🟡🟡⚫⚫🟡🟡🟡⚫🟡⚫⚫🟡🟡⚫🟡🟡⚫⚫⚫ ⚫🟡⚫⚫🟡🟡🟡🟡⚫⚫⚫⚫🟡⚫⚫⚫⚫🟡🟡⚫⚫⚫🟡⚫⚫🟡🟡🟡🟡 🟡🟡🟡⚫⚫🟡⚫🟡🟡⚫🟡⚫⚫⚫🟡🟡⚫🟡⚫⚫🟡🟡⚫🟡🟡🟡⚫🟡🟡 🟡⚫⚫🟡⚫🟡🟡🟡⚫⚫🟡🟡⚫⚫⚫🟡🟡⚫🟡🟡⚫⚫🟡⚫⚫⚫🟡⚫⚫ 🟡⚫🟡⚫⚫⚫⚫⚫🟡🟡🟡🟡🟡🟡🟡⚫⚫⚫⚫🟡🟡⚫🟡⚫🟡🟡⚫🟡🟡 🟡⚫🟡🟡⚫🟡🟡⚫⚫⚫🟡⚫🟡🟡⚫⚫⚫⚫⚫🟡🟡🟡🟡🟡🟡⚫🟡🟡⚫ ⚫⚫⚫⚫⚫⚫⚫⚫🟡🟡⚫⚫🟡⚫⚫⚫🟡🟡🟡🟡🟡⚫⚫⚫🟡🟡⚫⚫🟡 🟡🟡🟡🟡🟡🟡🟡⚫⚫⚫⚫⚫⚫⚫🟡⚫⚫⚫🟡🟡🟡⚫🟡⚫🟡⚫⚫⚫⚫ 🟡⚫⚫⚫⚫⚫🟡⚫⚫🟡⚫⚫🟡⚫🟡🟡🟡🟡⚫🟡🟡⚫⚫⚫🟡🟡⚫🟡🟡 🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡⚫⚫🟡🟡🟡🟡🟡🟡🟡🟡⚫ 🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡⚫🟡⚫🟡🟡⚫🟡🟡🟡🟡🟡🟡⚫🟡⚫⚫⚫⚫⚫ 🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡⚫⚫⚫⚫🟡🟡⚫⚫⚫🟡🟡🟡🟡🟡🟡🟡⚫🟡⚫ 🟡⚫⚫⚫⚫⚫🟡⚫⚫⚫⚫⚫🟡🟡⚫🟡🟡⚫🟡🟡⚫🟡⚫⚫🟡🟡⚫🟡⚫ 🟡🟡🟡🟡🟡🟡🟡⚫⚫🟡🟡⚫🟡🟡⚫⚫🟡🟡⚫⚫⚫⚫⚫⚫🟡🟡🟡⚫⚫ |