Updated on 2025-10-23 GMT+08:00

cursor.execute(query, args)

Description

This method executes the parameterized SQL statements (that is, placeholders instead of SQL literals).

Prototype

cursor.execute(query,args)

Parameters

Table 1 cursor.execute

Keyword

Parameter Description

query

SQL statement that you want to execute.

args

Variable list, which matches the %s placeholder in the query.

Return Value

None

Constraints

cursor.execute(query,args) queries only one SQL statement at a time and does not stack multiple SQL statements.

cursor.execute(query,args) does not use \0 in the entered SQL statement.

Examples

For details, see Examples: Common Operations.