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 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM 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

4 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
Sure a full fledged programming stack will obviously have a more mature tdd facilities. this if you choose to write sql . sql vs spark is probably a discussion for another time :0 > This just looks like a messier, more unclear way to test some SQL. As a software engineer I've written my own share of unit tests. They are supposed to be documentation of how a unit might work but it rarely ever works in that way. I found that to be more true for CSV tests for sql https://github.com/EqualExperts/dbt-unit-testing#different-w... because they are always in the same format , input csv -> output csv I am more motivated to look at the tests to see what sql is doing. Its pretty straight forward.
In Modern data modeling: Start with the end?
> I really don’t understand the communities obsession with unwieldy tools like DBT. It lets me write test first sql transforms. I never thought TDD sql would be possible. My sql is so much more readable with common logic extracted into ephmeral models. I practice same method to write clear code to write sql, eg: too many mocks = refactor into separate model ( class) . I think DBT made this possible with refs that can be swapped out with mocks. This is the awesome library I am using https://github.com/EqualExperts/dbt-unit-testing
In Modern data modeling: Start with the end?

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.