Introduction to SQLite with Python Programming

The purpose of our this Python SQLite tutorial, to demonstrate how to we can develop Python database applications with the SQLite database. We will learn that how we can perform SQLite database operations from Python.


Introduction to SQLite: Till know we are working with files to store or perform operations on our data. But for storing large amount of data, using file system as storage will not be the best option. As this will have many disadvantages.

SQLite is a type of Database Management System same like SQL and others. The data will be stored in the form of row and columns. We can perform more operations on our data stored in our databases as compared to files.


Drawbacks of using File System



1). Data Redundancy: By data redundancy we mean the duplicity of data, suppose we are managing the data of a company where an employee is enrolled for two or more responsibilities, the same employee details in such case will be stored multiple times, which will leads to the usage of more storage. The data redundancy mainly leads to max. storage costs and makes access time very poor.

2). Data Isolation: Data are stored various files, and that files may be in different formats, so in that case writing new application programs to fetch/retrieve the required data may be difficult.

3). Data Inconsistency: Data inconsistency relates with data redundancy, let’s take same example as we have taken above. An employee is enrolled for two or more responsibilities, suppose if employee request for his address change. If the address is changed at one place but not on all the records, in that case the problem occurs is called data inconsistency.

4). Data Security: Data stored should always be secured from the unauthorized access or third party access, for example an employee in a company should not be able to see the payroll of his manager, this types of security constraints are very hard to apply in file systems.

5). Dependency: Sometimes application is dependent on the file/data. So, changing files would also leads to change in the application programs.

6). Atomicity Issues: By atomicity we mean the roll back process. This process should execute automatically, if there is any error occurs in the complete execution of our program.

The best example to understand the concept of atomicity is the transaction process of bank. Suppose David transferred $500 to Ovens account but due to some technical error from bank side amount is not transferred. But amount is debited from David’s account but it did not credited back. Hence this type of issues are common in file systems.


Advantages of using Databases over Files


Advantages of Databases over file system are given below:

1). No Redundant Data: Data redundancy means the duplicacy in data, it has been solved by using NormalizationHence the problem of data redundancy or data duplicacy has been solved in databases.

2). Data Consistency: As data consistency relates with data redundancy, so the problem of data redundancy is solved by Normalization. Hence problem of data consistency is also solved in SQLite databases.

3). Privacy: Databases provides privacy to our data.

4). Easy Recovery: Information lost or data lost can be recovered very easily in databases.

5). Easily Accessible: Data stored in databases are in format of rows and columns. It is easy to access data from databases as compared to File Systems.

6). Data Security: Databases are highly secured with passwords. Hence data stored in databases are secured.