This project demonstrates how to fetch JSON data from an API and upload it into a PostgreSQL database using Python and the psycopg2 library.
Before running the script, make sure you have the following:
-
Python 3.x installed on your system.
-
PostgreSQL database installed on your system.
-
psycopg2 library installed. You can install it using the following command:
pip install psycopg2- Clone this repository using the following command:
git clone https://github.com/Sujan167/Bulk-data-with-python-and-postgres.git
- Navigate to the project directory.
host = 'localhost',
port = '5432',
user = 'postgres',
password = '****',
dbname = 'postgres'
- Run the script.py file using the following command:
python3 script.pyThis will fetch the JSON data, create a table in the PostgreSQL database, and insert the data into the table.