Skip to content

QR Codes functions in the Textplot DuckDB extension

Function category

QR Codes

1 function

Encode strings as QR codes rendered as Unicode-block art. Useful for dashboards, terminal output, and embedding scannable links in docs.

tp_qr

Scalar function QR Codes
Signature
tp_qr( value: VARCHAR, ecc := VARCHAR = 'low', off := VARCHAR = '⬜', on := VARCHAR = '⬛' ) VARCHAR
Arguments
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
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" := '⚫')
🟡🟡🟡🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫⚫⚫🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡🟡
🟡⚫⚫⚫⚫⚫🟡⚫🟡⚫⚫⚫🟡⚫🟡⚫🟡⚫⚫🟡⚫⚫🟡⚫⚫⚫⚫⚫🟡
🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡⚫🟡🟡⚫⚫🟡🟡⚫🟡⚫🟡🟡🟡⚫🟡
🟡⚫🟡🟡🟡⚫🟡⚫⚫⚫⚫🟡🟡🟡⚫⚫🟡🟡⚫🟡⚫⚫🟡⚫🟡🟡🟡⚫🟡
🟡⚫🟡🟡🟡⚫🟡⚫⚫⚫🟡🟡🟡🟡🟡🟡⚫⚫⚫🟡🟡⚫🟡⚫🟡🟡🟡⚫🟡
🟡⚫⚫⚫⚫⚫🟡⚫🟡⚫⚫🟡⚫⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫⚫⚫⚫⚫🟡
🟡🟡🟡🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡🟡
⚫⚫⚫⚫⚫⚫⚫⚫🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫⚫⚫🟡⚫⚫⚫⚫⚫⚫⚫⚫
⚫⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫⚫🟡🟡🟡
🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡🟡🟡⚫🟡⚫🟡⚫⚫⚫⚫⚫🟡⚫⚫🟡🟡🟡⚫🟡
🟡🟡🟡⚫⚫🟡🟡🟡🟡⚫⚫🟡⚫⚫🟡⚫🟡🟡🟡⚫🟡🟡🟡🟡🟡⚫🟡⚫⚫
🟡⚫⚫⚫⚫⚫⚫⚫🟡🟡⚫🟡⚫🟡⚫⚫⚫⚫⚫⚫⚫🟡🟡🟡⚫🟡⚫🟡⚫
⚫🟡🟡🟡🟡🟡🟡⚫⚫⚫⚫🟡🟡🟡🟡🟡⚫⚫🟡⚫🟡🟡⚫🟡⚫⚫🟡🟡🟡
🟡⚫🟡⚫🟡🟡⚫⚫⚫⚫⚫⚫🟡🟡🟡⚫🟡🟡⚫🟡🟡🟡🟡⚫🟡🟡⚫🟡🟡
⚫⚫⚫🟡⚫⚫🟡⚫🟡🟡⚫🟡🟡⚫⚫⚫🟡⚫⚫⚫🟡⚫🟡🟡⚫⚫⚫🟡⚫
⚫⚫🟡⚫⚫🟡⚫⚫🟡⚫🟡🟡⚫⚫🟡🟡🟡⚫🟡⚫⚫🟡🟡⚫🟡🟡⚫⚫⚫
⚫🟡⚫⚫🟡🟡🟡🟡⚫⚫⚫⚫🟡⚫⚫⚫⚫🟡🟡⚫⚫⚫🟡⚫⚫🟡🟡🟡🟡
🟡🟡🟡⚫⚫🟡⚫🟡🟡⚫🟡⚫⚫⚫🟡🟡⚫🟡⚫⚫🟡🟡⚫🟡🟡🟡⚫🟡🟡
🟡⚫⚫🟡⚫🟡🟡🟡⚫⚫🟡🟡⚫⚫⚫🟡🟡⚫🟡🟡⚫⚫🟡⚫⚫⚫🟡⚫⚫
🟡⚫🟡⚫⚫⚫⚫⚫🟡🟡🟡🟡🟡🟡🟡⚫⚫⚫⚫🟡🟡⚫🟡⚫🟡🟡⚫🟡🟡
🟡⚫🟡🟡⚫🟡🟡⚫⚫⚫🟡⚫🟡🟡⚫⚫⚫⚫⚫🟡🟡🟡🟡🟡🟡⚫🟡🟡⚫
⚫⚫⚫⚫⚫⚫⚫⚫🟡🟡⚫⚫🟡⚫⚫⚫🟡🟡🟡🟡🟡⚫⚫⚫🟡🟡⚫⚫🟡
🟡🟡🟡🟡🟡🟡🟡⚫⚫⚫⚫⚫⚫⚫🟡⚫⚫⚫🟡🟡🟡⚫🟡⚫🟡⚫⚫⚫⚫
🟡⚫⚫⚫⚫⚫🟡⚫⚫🟡⚫⚫🟡⚫🟡🟡🟡🟡⚫🟡🟡⚫⚫⚫🟡🟡⚫🟡🟡
🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡⚫⚫🟡🟡🟡🟡🟡🟡🟡🟡⚫
🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡⚫🟡⚫🟡🟡⚫🟡🟡🟡🟡🟡🟡⚫🟡⚫⚫⚫⚫⚫
🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡⚫⚫⚫⚫🟡🟡⚫⚫⚫🟡🟡🟡🟡🟡🟡🟡⚫🟡⚫
🟡⚫⚫⚫⚫⚫🟡⚫⚫⚫⚫⚫🟡🟡⚫🟡🟡⚫🟡🟡⚫🟡⚫⚫🟡🟡⚫🟡⚫
🟡🟡🟡🟡🟡🟡🟡⚫⚫🟡🟡⚫🟡🟡⚫⚫🟡🟡⚫⚫⚫⚫⚫⚫🟡🟡🟡⚫⚫