working with the pymysql module database these users are authenticated by requiring them to provide password the password for the user the database instance to connect to as mentioned in the previous database management system (dmscan manage multiple database instances and thus it is necessary to say which database instance you are interested in for exampleopen database connection connection pymysql connect('localhost','username','password','unidatabase'in this case the machine we are connecting to is 'localhost(that is the same machine as the python program itself is running on)the user is represented by 'usernameand 'passwordand the database instance of interest is called 'uni-databasethis returns connection object as per the db-api standard obtaining the cursor object you can obtain the cursor object from the connection using the cursor(methodprepare cursor object using cursor(method cursor connection cursor(using the cursor object once you have obtained the cursor object you can use it to execute an sql query or dml insertupdate or delete statement the following example uses simple select statement to select all the attributes in the students table for all rows currently stored in the students tableexecute sql query using execute(method cursor execute('select from students'note that this method executes the select statement but does not return the set of results directly instead the execute method returns an integer indicating the number of rows either affected by the modification or returned as part of the query in the case of select statement the number returned can be used to determine which type of fetch method to use