0
 try:
            for i in (0, nCount):
                query = "INSERT INTO students (Name, ID, Birth) VALUES (%s %d %d);"
                data = ('Y', 2, 9)
                cur.execute(query, data)
                conn.commit()

 except:
            print("I can't INSERT into students")

Connect to database and select operation are work but insert operation is not.
I use PostgreSQL and pgAdmin4
And create database use pgAdmin4
The DB structure is Name(text), Id(integer), Birth(integer)

-------------------------------------------------------------------------
Solve
* Change type of all columns to text (not text[]).
* Change column name in DB to small letter.

1 Answer 1

1

From my best knowledge you missed , in values clause. I think you need write smthng like values (%s,%d,%d)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.