Sunday, 12 June 2016

Python: MySQLdb: Cursor object

Cursor object provides number of methods to execute stored procedure, get records from database, execute sql statements, skip records etc.,

Following table summarizes the methods provided by Cursor class.

Method
Description
.callproc ( procname [, parameters ] )
Call a database stored procedure.
.close()
Close the cursor.
.execute ( operation [, parameters ])
Prepare and execute a database query.
.executemany ( operation , seq_of_parameters )
Prepare a database operation and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters .
.fetchone ()
Fetch next row of the result set
.fetchmany ([ size=cursor.arraysize ])
Fetch size number of rows of result set.
.fetchall ()
Fetch all the rows of query result
.nextset ()
This method will make the cursor skip to the next available set, discarding any remaining rows from the current set.
.arraysize
This read/write attribute specifies the number of rows to fetch at a time with .fetchmany() . It defaults to 1 meaning to fetch a single row at a time.
.setoutputsize ( size [, column ])
Set a column buffer size for fetches of large columns.





Previous                                                 Next                                                 Home

No comments:

Post a Comment