Ask HN: How do you test SQL?
663 pointsI've been looking for resources for our data team to apply best practices for testing SQL pipelines (we use DBT) but have not found anything. How do you test SQL pipelines? What patterns, tools and best practices would you recommend? Any good reference material you know of?
Comments (315) 98 threads
Show all comments
Showing thread 12 of 98
1) The same way you'd write any other tests. Use your favourite testing framework to write fixtures and tests for the SQL queries:
For insert or update queries, that assertion step might involve running another query.2) DBT has support for testing! It's quite good. See https://docs.getdbt.com/docs/build/tests