0% found this document useful (0 votes)
3 views1 page

MySQL Python Connectivity Summary

The document outlines various methods and attributes for connecting MySQL with Python. Key methods include connect() for establishing a connection, cursor() for creating a cursor, and execute() for running SQL queries. Additional methods like fetchone(), fetchall(), and commit() are also detailed for handling data retrieval and transaction management.

Uploaded by

Namrata Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

MySQL Python Connectivity Summary

The document outlines various methods and attributes for connecting MySQL with Python. Key methods include connect() for establishing a connection, cursor() for creating a cursor, and execute() for running SQL queries. Additional methods like fetchone(), fetchall(), and commit() are also detailed for handling data retrieval and transaction management.

Uploaded by

Namrata Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Summary Table: MySQL and Python Connectivity Methods

Method / Attribute Belongs To Purpose


connect() [Link] Establishes connection to
MySQL database
cursor() Connection object Creates a cursor for
executing SQL queries
execute() Cursor Executes SQL query
(SELECT, INSERT, UPDATE,
DELETE)
fetchone() Cursor Fetches the next single
record from result set
fetchall() Cursor Fetches all remaining
records from result set
fetchmany(n) Cursor Fetches n number of
records from result set
commit() Connection Saves changes (commits
transactions)
rollback() Connection Cancels uncommitted
changes
rowcount Cursor Returns number of rows
affected by last SQL
command
close() Connection/Cursor Closes the cursor or
connection properly

You might also like