makes_progress.sql 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. -- Copyright Materialize, Inc. and contributors. All rights reserved.
  2. --
  3. -- Use of this software is governed by the Business Source License
  4. -- included in the LICENSE file at the root of this repository.
  5. --
  6. -- As of the Change Date specified in that file, in accordance with
  7. -- the Business Source License, use of this software will be governed
  8. -- by the Apache License, Version 2.0.
  9. {% test makes_progress(model) %}
  10. -- {{ model }} must be mentioned somewhere in the query or dbt will croak */
  11. {% set query %}
  12. SET CLUSTER = qa_canary_environment_compute;
  13. BEGIN;
  14. DECLARE c1 CURSOR FOR SUBSCRIBE ( SELECT * FROM {{ model }} ) WITH (SNAPSHOT = FALSE);
  15. -- TODO: Switch timeout back to 60s after database-issues#6647 is fixed
  16. FETCH 1 c1 WITH (timeout='300s');
  17. {% endset %}
  18. {% set result = run_query(query) %}
  19. {% if execute %}
  20. SELECT 1 WHERE {{ result.rows | length }} = 0
  21. {% endif %}
  22. -- we need to explicitly reset the current transaction
  23. -- so that a new one is opened for the next SUBSCRIBE
  24. {% do run_query("ROLLBACK") %}
  25. {% endtest %}