diff --git a/tests/tests__block_timestamp_order.sql b/tests/tests__block_timestamp_order.sql new file mode 100644 index 0000000..78860b9 --- /dev/null +++ b/tests/tests__block_timestamp_order.sql @@ -0,0 +1,20 @@ +{{ config( + severity = "error" +) }} + +SELECT + DATEDIFF( + SECOND, + A.block_timestamp, + b.block_timestamp + ) AS avg_time_diff, + b.block_height AS bheight, + b.block_timestamp AS btime, + A.* +FROM + {{ ref('silver__blocks') }} A, + {{ ref('silver__blocks') }} + b +WHERE + A.block_height = b.block_height -1 + AND avg_time_diff < 0