|
38 | 38 |
|
39 | 39 | FlaskInstrumentor().instrument(enable_commenter=True, commenter_options={})
|
40 | 40 |
|
| 41 | +For example, FlaskInstrumentor when used with SQLAlchemyInstrumentor or Psycopg2Instrumentor, |
| 42 | +invoking ``cursor.execute("select * from auth_users")`` will lead to sql query |
| 43 | +``select * from auth_users`` but when SQLCommenter is enabled the query will get appended with |
| 44 | +some configurable tags like: |
41 | 45 |
|
42 |
| -For example, |
43 |
| -:: |
| 46 | +.. code:: |
44 | 47 |
|
45 |
| - FlaskInstrumentor when used with SQLAlchemyInstrumentor or Psycopg2Instrumentor, invoking cursor.execute("select * from auth_users") |
46 |
| - will lead to sql query "select * from auth_users" but when SQLCommenter is enabled |
47 |
| - the query will get appended with some configurable tags like "select * from auth_users /*metrics=value*/;" |
| 48 | + select * from auth_users /*metrics=value*/;" |
48 | 49 |
|
49 |
| - Inorder for the commenter to append flask related tags to sql queries, the commenter needs to enabled on |
50 |
| - the respective SQLAlchemyInstrumentor or Psycopg2Instrumentor framework too. |
| 50 | +Inorder for the commenter to append flask related tags to sql queries, the commenter needs |
| 51 | +to enabled on the respective SQLAlchemyInstrumentor or Psycopg2Instrumentor framework too. |
51 | 52 |
|
52 | 53 | SQLCommenter Configurations
|
53 | 54 | ***************************
|
54 |
| -We can configure the tags to be appended to the sqlquery log by adding configuration inside commenter_options(default:{}) keyword |
| 55 | +We can configure the tags to be appended to the sqlquery log by adding configuration |
| 56 | +inside ``commenter_options={}`` dict. |
55 | 57 |
|
56 |
| -framework = True(Default) or False |
| 58 | +For example, enabling this flag will add flask and it's version which |
| 59 | +is ``/*flask%%3A2.9.3*/`` to the SQL query as a comment (default is True): |
57 | 60 |
|
58 |
| -For example, |
59 |
| -:: |
60 |
| -Enabling this flag will add flask and it's version which is /*flask%%3A2.9.3*/ |
| 61 | +.. code:: python |
61 | 62 |
|
62 |
| -route = True(Default) or False |
| 63 | + framework = True |
63 | 64 |
|
64 |
| -For example, |
65 |
| -:: |
66 |
| -Enabling this flag will add route uri /*route='/home'*/ |
| 65 | +For example, enabling this flag will add route uri ``/*route='/home'*/`` |
| 66 | +to the SQL query as a comment (default is True): |
67 | 67 |
|
68 |
| -controller = True(Default) or False |
| 68 | +.. code:: python |
69 | 69 |
|
70 |
| -For example, |
71 |
| -:: |
72 |
| -Enabling this flag will add controller name /*controller='home_view'*/ |
| 70 | + route = True |
| 71 | +
|
| 72 | +For example, enabling this flag will add controller name ``/*controller='home_view'*/`` |
| 73 | +to the SQL query as a comment (default is True): |
| 74 | +
|
| 75 | +.. code:: python |
| 76 | +
|
| 77 | + controller = True |
73 | 78 |
|
74 | 79 | Usage
|
75 | 80 | -----
|
|
0 commit comments