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)
| 127 | raise err.ProgrammingError(str(m)) |
| 128 | |
| 129 | def mogrify(self, query, args=None) -> str: |
| 130 | """ |
| 131 | Returns the exact string that would be sent to the database by calling the |
| 132 | execute() method. |
| 133 | |
| 134 | :param query: Query to mogrify. |
| 135 | :type query: str |
| 136 | |
| 137 | :param args: Parameters used with query. (optional) |
| 138 | :type args: tuple, list or dict |
| 139 | |
| 140 | :return: The query with argument binding applied. |
| 141 | :rtype: str |
| 142 | |
| 143 | This method follows the extension to the DB API 2.0 followed by Psycopg. |
| 144 | """ |
| 145 | if args is None: |
| 146 | return query |
| 147 | |
| 148 | return self._mogrify(query, args) |
| 149 | |
| 150 | def execute(self, query, args=None): |
| 151 | """Execute a query. |