Python SQL Scripting
- Name: Abdulrahman Awad
In order to connect to the database you need to install the psycopg package. You can install it using the following command:
pip install --upgrade pip # upgrade pip to at least 20.3
pip install "psycopg[binary]" # remove [binary] for PyPyYou can reset (delete existing tables) and create the database from scratch and the student table as well as populate the student table with initial values using the following command:
cd into the DB_scripts directory and run the DB_create.py file using the following command:
cd DB_scripts
python DB_create.pycd into the DB_scripts directory and run the test_script.py file using the
following command:
cd DB_scripts
python test_script.pyDB_scripts/DB_create.py: This file is used to create the database and the student table.DB_scripts/crud_functions.py: This file contains the CRUD functions that preform the crud operations on the student table by connecting to the database using psycopg.DB_scripts/test_script.py: This file is used to test the CRUD functions on the student table by calling the crud functions and displaying the records after each operationREADME.md: This file contains the instructions and information about the project.DDL_Students.sql: This file contains the DDL statements to create and insert into the student table.