QRFY model
Qr codes
Every QR code in the account with QRFY's lifetime scan counter: the My QR Codes list.
- Grain
- one row per QR code, as of the last sync
- Built from
- 1Raw tables
- 1Staging
- 1Core
- 1Analytics
- Reads from QRFY
- qr
- Ships as
- Weld and dbt SQL, open source on GitHub
core.qrfy.qr_codes
1-- core.qrfy.qr_codes
2-- Every QR code in the account with QRFY's lifetime scan counter: the My QR Codes list.
3--
4-- Grain: one row per QR code, as of the last sync.
5-- Depends on: staging.qrfy.qr
6--
7-- `lifetime_scans` is QRFY's own total and is the number to reconcile the scan models
8-- against: summed over all time, scans_daily.scans for a code should approach it. The two
9-- are not joined here because scan rows carry the short link, not the code id.
10-- `scans_to_limit` is how many scans remain before a code with a scan limit stops.
11
12SELECT
13 qr_id,
14 qr_name,
15 qr_type,
16 folder,
17 is_active,
18 is_stopped,
19 short_code,
20 hostname,
21 final_url,
22 lifetime_scans,
23 scan_limit,
24 IF(scan_limit > 0, scan_limit - lifetime_scans, NULL) AS scans_to_limit,
25 created_at,
26 DATE_DIFF(CURRENT_DATE(), DATE(created_at), DAY) AS age_days,
27 SAFE_DIVIDE(lifetime_scans,
28 GREATEST(DATE_DIFF(CURRENT_DATE(), DATE(created_at), DAY), 1)) AS avg_scans_per_day
29FROM {{staging.qrfy.qr}}This model and the 2 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().
Notes
How it counts. And where it stops.
`lifetime_scans` is QRFY's own total and is the number to reconcile the scan models against: summed over all time, scans_daily.scans for a code should approach it. The two are not joined here because scan rows carry the short link, not the code id. `scans_to_limit` is how many scans remain before a code with a scan limit stops.
Raw tables it reads
- raw.qrfy.qr
More QRFY models
Put QRFY in front
of your agents.
Connect QRFY, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.