blob: 34bb470ff39ae1d5b93eb2a0960da5a4a41cb425 [file] [log] [blame]
James E. Blaireff5a9d2017-06-20 00:00:37 -07001:title: SQL Driver
2
3SQL
4===
5
6The SQL driver supports reporters only. Only one connection per
James E. Blair83786d42017-08-04 08:43:59 -07007database is permitted.
James E. Blaireff5a9d2017-06-20 00:00:37 -07008
James E. Blair83786d42017-08-04 08:43:59 -07009Connection Configuration
10------------------------
James E. Blaireff5a9d2017-06-20 00:00:37 -070011
James E. Blair83786d42017-08-04 08:43:59 -070012The connection options for the SQL driver are:
13
14.. attr:: <sql connection>
15
16 .. attr:: driver
17 :required:
18
19 .. value:: sql
20
21 The connection must set ``driver=sql`` for SQL connections.
22
23 .. attr:: dburi
24 :required:
25
26 Database connection information in the form of a URI understood
27 by SQLAlchemy. See `The SQLAlchemy manual
28 <http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#database-urls>`_
29 for more information.
James E. Blaireff5a9d2017-06-20 00:00:37 -070030
Joshua Hesketh7ab7c632017-10-16 15:03:26 +110031 The driver will automatically set up the database creating and managing
32 the necesssary tables. Therefore the provided user should have sufficient
33 permissions to manage the database. For example:
34
35 .. code-block:: sql
36
37 GRANT ALL ON my_database TO 'my_user'@'%';
38
James E. Blaireff5a9d2017-06-20 00:00:37 -070039Reporter Configuration
40----------------------
41
42This reporter is used to store results in a database.
43
44A :ref:`connection<connections>` that uses the sql driver must be
45supplied to the reporter.
46
James E. Blair83786d42017-08-04 08:43:59 -070047``zuul.conf`` contains the database connection and credentials. To
48store different reports in different databases you'll need to create a
49new connection per database.
James E. Blaireff5a9d2017-06-20 00:00:37 -070050
James E. Blair83786d42017-08-04 08:43:59 -070051The SQL reporter does nothing on :attr:`pipeline.start` or
52:attr:`pipeline.merge-failure`; it only acts on
53:attr:`pipeline.success` or :attr:`pipeline.failure` reporting stages.
54
55For example:
56
57.. code-block:: yaml
58
59 - pipeline:
60 name: post-merge
61 success:
James E. Blaird5e29562017-08-04 09:48:59 -070062 mydb_conn:
James E. Blair83786d42017-08-04 08:43:59 -070063 failure:
James E. Blaird5e29562017-08-04 09:48:59 -070064 mydb_conn:
James E. Blair83786d42017-08-04 08:43:59 -070065
66.. attr:: pipeline.<reporter>.<sql source>
67
James E. Blaird5e29562017-08-04 09:48:59 -070068 To report to a database, add a key with the connection name and an
69 empty value to the desired pipeline :ref:`reporter<reporters>`
70 attributes.