import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="12345",
database="test"
)
query = mydb.cursor()
query.execute("CREATE TABLE patient (patient_id INT ,name VARCHAR(255), address VARCHAR(255))")
create_record = "INSERT INTO patient (patient_id,name, address) VALUES (1, "John" "john@gmail.com")"
query.execute(create_record)
query.execute("SELECT * FROM patient")
result = query.fetchall()
import json
resultLoaded = json.loads(result)
Comments
Leave a comment