HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
EqualExperts
dbt-unit-testing
Shell2022–2023
EqualExperts / dbt-unit-testing

dbt-unit-testing

This dbt package contains macros to support unit testing that can be (re)used across dbt projects.

3Distinct people
4Mentions
0Explicit recommenders
448GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

This dbt package contains macros to support unit testing that can be (re)used across dbt projects.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 9:28:18 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week4 dated mentions

Observed mentions: 2022-12-05 15:34:32 UTC to 2023-01-31 22:27:34 UTC. Weeks start Monday, UTC.

0122022-12-05 00:00:00 UTC to 2022-12-12 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsDec 52022-12-12 00:00:00 UTC to 2022-12-19 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-12-19 00:00:00 UTC to 2022-12-26 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-12-26 00:00:00 UTC to 2023-01-02 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-02 00:00:00 UTC to 2023-01-09 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsJan 22023-01-09 00:00:00 UTC to 2023-01-16 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-16 00:00:00 UTC to 2023-01-23 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-23 00:00:00 UTC to 2023-01-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-30 00:00:00 UTC to 2023-02-06 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsJan 30

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Dec 52022-12-05 00:00:00 UTC2022-12-12 00:00:00 UTC202
Dec 122022-12-12 00:00:00 UTC2022-12-19 00:00:00 UTC000
Dec 192022-12-19 00:00:00 UTC2022-12-26 00:00:00 UTC000
Dec 262022-12-26 00:00:00 UTC2023-01-02 00:00:00 UTC000
Jan 22023-01-02 00:00:00 UTC2023-01-09 00:00:00 UTC000
Jan 92023-01-09 00:00:00 UTC2023-01-16 00:00:00 UTC000
Jan 162023-01-16 00:00:00 UTC2023-01-23 00:00:00 UTC000
Jan 232023-01-23 00:00:00 UTC2023-01-30 00:00:00 UTC000
Jan 302023-01-30 00:00:00 UTC2023-02-06 00:00:00 UTC202

What Hacker News says

2 sources
We use this and take an example-based tests approach for any non-trivial DBT models: https://github.com/EqualExperts/dbt-unit-testing More trivial example: {% call dbt_unit_testing.test( 'REDACTED', 'Should replace nullish values with NULL' ) %} {% call dbt_unit_testing.mock_source('REDACTED', 'REDACTED', opts) %} "id" | "industry" 1 | 'A' 2 | 'B' 3 | '' 4 | 'Other' 5 | 'C' 6 | NULL {% endcall %} {% call dbt_unit_testing.expect(opts) %} "history_id" | "REDACTED" 1 | 'A' 2 | 'B' 3 | NULL 4 | NULL 5 | 'C' 6 | NULL
Read the rest
{% endcall %} {% endcall %}
In Ask HN: How do you test SQL?
> How do you test some SQL logic in isolation? I do this using sql 1. Extracting an 'ephemeral model' to different model file 2. Mock out this model in upstream model in unit tests https://github.com/EqualExperts/dbt-unit-testing 3. Write unit tests for this model. This is not different than regular software development in a language like java. I would argue its even better better because unit tests are always in tabular format and pretty easy to understand. Java unit tests on other hand are never read by devs in practice. > in this day and age where enriching the data by running it through some ML model isn't that rare, Still pretty rare, This constitutes a very minor percentage of ETL in an typical enterprise.
In SQL should be the default choice for data transformation logic

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.