Count total number of changes made after connecting SQLite to Python
In this article, we are going to see how to count total changes since the SQLite database connection is open using Python. To get the total number of changes we use the connection object’s total_changes property.
Class Instance: sqlite3.Connection
Return Value: Total no. of rows inserted, deleted, updated since the database connection is open.
For the demonstration purpose, we would be using person table stored in geeks.db database.
CREATE TABLE person( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER NOT NULL);
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course