3. DB Read, Insert & Update Operations
In the next steps, we need to add operations related to data such as inserting, updating, or reading data.
3. DB Read, Insert & Update Operations
In the next steps, we need to add operations related to data such as inserting, updating, or reading data.
2. Automated Testing
Now that we have the DB connection, we need to integrate automated testing. For this, we will use Python's standard unittest module.
Code Testing (Test): Automated testing should verify that the operations related to the DB are being performed correctly.
Step one: Create a framework for testing the code.
Step two: Verify each connection with the DB.
1. DB Connection
Often, developers begin their work with databases by establishing a DB connection. This is the first step because this connection is required in order to fetch or insert data. Honestly, without this connection, no operations can be performed on the database.
The Connection (Interface):
The entire code starts with the pymysql library. There are alternative libraries as well, such as psycopg2 for PostgreSQL, but for now, we’ll focus on MySQL and begin with pymysql.
You create a connection to interact with the database, and through this connection, you will execute SQL queries.
Karen Grigorian 100%
Amina Bell yes 🙃 🙃 🙃
David Rivera Yes!
Hayk Khachatryan Tenca vor ka lriv 👍
Amina Bell ha irakanum
Key Points to Remember:
Object-Oriented Programming makes the program easy to understand as well as efficient.
Since the class is sharable, the code can be reused.
Data is safe and secure with data abstraction.
Polymorphism allows the same interface for different objects, so programmers can write efficient code.
Polymorphism
Polymorphism is another important concept of object-oriented programming. It simply means more than one form.
That is, the same entity (method or operator or object) can perform different operations in different scenarios.
David Rivera What is SQL mean?