0

Trying to insert into a null value to MySql table using python. Below is the code executed

sql="""insert into db.table_name (int_column, column2) values (None, 'test')"""
cursor.execute(sql)

while running getting below error

mysql.connector.errors.ProgrammingError: 1054 (42s22) : Unknown column 'None' in 'field list'

Tried this out with reference to this solution

1
  • 1
    values (null, 'test') Commented May 5, 2020 at 8:28

1 Answer 1

2

try the following, replace your none with null

sql="""insert into db.table_name (int_column, column2) values (null, 'test')"""
cursor.execute(sql)
Sign up to request clarification or add additional context in comments.

Comments

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.