1.4.11.4 The Easy Way

If you are using the advanced cursor methods like cursor.insert() or cursor.update() (described later) or parameter substitution (described earlier), the easiest way to deal with special characters is to do nothing with them at all. The methods will automatically handle the conversions for you.

For example:

cursor.insert(
    table='table',
    columns=['columnOne'],
    values=["James's"],
)

or

cursor.execute("INSERT INTO table (columnOne) VALUES (?)", "James's")

If you want explicitly want to use the cursor methods like cursor.insert() or cursor.update() but with quoted SQL strings rather than having the conversions done automatically you can do so like this:

cursor.insert(
    table='table',
    columns=['columnOne'],
    __sqlValues=["'James''s'"],
)