You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/07 08:24:00 UTC

[GitHub] [airflow] ashb commented on a change in pull request #8754: Add SQL query tracking for pytest

ashb commented on a change in pull request #8754:
URL: https://github.com/apache/airflow/pull/8754#discussion_r421321737



##########
File path: TESTING.rst
##########
@@ -902,6 +902,36 @@ You should also consider running it with ``restart`` command when you change the
 This will clean-up the database so that you start with a clean DB and not DB installed in a previous version.
 So typically you'd run it like ``breeze --install-airflow-version=1.10.9 restart``.
 
+Tracking SQL statements
+=======================
+
+You can run tests with SQL statements tracking. To do this, use the ``--trace-sql`` option and pass the
+columns to be displayed as an argument. Each query will be displayed on a separate line.
+Supported values:
+
+* ``no`` -  displays the query number;
+* ``time`` - displays the query execution time;
+* ``trace`` - displays the simplified (one-line) stack trace;
+* ``sql`` - displays the SQL statements;
+* ``parameters`` - display SQL statement parameters.
+
+If you only provide ``no``, then only the final number of queries in the test will be displayed.
+
+By default, pytest does not display output for successful tests, if you still want to see them, you must
+pass the ``--capture=no`` option.
+
+If you run the following command:
+
+.. code-block:: bash
+
+    pytest --debug-sql=no,sql,parameters --capture=no \

Review comment:
       Could we change `no` to `num`? Little bit confusing otherwise where other pytest flags treat no as a bool.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org