Converter objects contain methods to convert values between SQL and Python objects and to convert values returned by the database driver into the correct Python type. Converter objects are accessed through the converter attribute of the corresponding Column object.
Example: convert a list of values selected from a database to their SQL encoded equivalents
>>> cursor.select(columns=['table1.columnOne', 'table2.column2'], tables=['table1', 'table2'], execute=True) >>> results = cursor.fetchall() >>> record = results[0] >>> newRecord = [] >>> for i in range(len(record)): ... newRecord.append(cursor.info[i].converter.valueToSQL(record[i]))
| value) |
| value) |
| value) |
| value) |
True if the SQL representation should be quoted, False otherwise
Converter objects are also available as a dictionary with column types as the keys as the converters attribute of the Connection object.