Returns the exact string that would be sent to the database by calling the execute() method. :param query: Query to mogrify. :type query: str :param args: Parameters used with query. (optional) :type args: tuple, list or dict :return: The q
(self, query, args=None)
| 114 | return conn.escape(args) |
| 115 | |
| 116 | def mogrify(self, query, args=None): |
| 117 | """ |
| 118 | Returns the exact string that would be sent to the database by calling the |
| 119 | execute() method. |
| 120 | |
| 121 | :param query: Query to mogrify. |
| 122 | :type query: str |
| 123 | |
| 124 | :param args: Parameters used with query. (optional) |
| 125 | :type args: tuple, list or dict |
| 126 | |
| 127 | :return: The query with argument binding applied. |
| 128 | :rtype: str |
| 129 | |
| 130 | This method follows the extension to the DB API 2.0 followed by Psycopg. |
| 131 | """ |
| 132 | conn = self._get_db() |
| 133 | |
| 134 | if args is not None: |
| 135 | query = query % self._escape_args(args, conn) |
| 136 | |
| 137 | return query |
| 138 | |
| 139 | def execute(self, query, args=None): |
| 140 | """Execute a query. |
no test coverage detected