Python Forum
I don't know what is wrong (Python and SQL connection)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I don't know what is wrong (Python and SQL connection)
#4
Maybe the CREATE command has a problem?

Instead of AUTOINCREMENT try AUTO_INCREMENT? Otherwise AUTOINCREMENT may be interpreted as a column name.

Quote:CREATE TABLE IF NOT EXISTS patients (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
reference_no TEXT,
issued_date TEXT,
appointment_date TEXT,
patient_id TEXT,
patient_name TEXT,
date_of_birth TEXT,
patient_address TEXT,
nhs_number TEXT,
name_of_tablets TEXT,
no_of_tablets TEXT,
dose TEXT,
use_medication TEXT,
doctor_name TEXT
)

This works in my MySQL database:

Quote:INSERT INTO patients (
reference_no, issued_date, appointment_date, patient_id, patient_name, date_of_birth,
patient_address, nhs_number, name_of_tablets, no_of_tablets, dose, use_medication, doctor_name
) VALUES ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M')

SELECT id, use_medication, doctor_name FROM patients WHERE 1
Reply


Messages In This Thread
RE: I don't know what is wrong (Python and SQL connection) - by Pedroski55 - Apr-01-2024, 08:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  No Internet connection when running a Python script basil_555 8 709 Mar-11-2024, 11:02 AM
Last Post: snippsat
  Connection LTspice-Python with PyLTSpice bartel90 0 382 Feb-05-2024, 11:46 AM
Last Post: bartel90
  Virtual Env changing mysql connection string in python Fredesetes 0 406 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  connection python and SQL dawid294 4 730 Dec-12-2023, 08:22 AM
Last Post: Pedroski55
  Networking Issues - Python GUI client and server connection always freezes Veritas_Vos_Liberabit24 0 759 Mar-21-2023, 03:18 AM
Last Post: Veritas_Vos_Liberabit24
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,642 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  Python MYSQL connection does not work after 1h idle zazas321 9 6,979 Oct-07-2021, 12:02 PM
Last Post: ndc85430
  Serial connection connection issue Joni_Engr 15 8,221 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  How can I make a plot representing connection relationship with python matplotlib? Berlintofind 1 1,979 May-08-2020, 09:27 PM
Last Post: jefsummers
  Connection DATABASE to Python MenThoLLt 3 2,467 Jan-17-2020, 10:35 PM
Last Post: DT2000

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020