singlestoredb.connection.Cursor.execute¶
- abstract Cursor.execute(query: str, args: Sequence[Any] | Dict[str, Any] | Any | None = None) int ¶
Execute a SQL statement.
Queries can use the
format
-style parameters (%s
) when using a list of paramters orpyformat
-style parameters (%(key)s
) when using a dictionary of parameters.- Parameters:
Examples
>>> cur.execute('select * from mytable')
>>> cur.execute('select * from mytable where id < %s', [100])
>>> cur.execute('select * from mytable where id < %(max)s', dict(max=100))
- Return type:
Number of rows affected