How to solve the error 'Connection' object has no attribute 'commit'?

engine = create_engine('mysql+mysqlconnector:mysettings', poolclass=NullPool)
connection = engine.connect()
organization = connection.execute(
 "INSERT INTO client (`ip_port`, `okpo`, `chat_id`, `admin_id`, `activate`, `white_list`) VALUES (%s, %s, %s, %s, %s, %s);",
 (ip, okpo, chat_id, admin_id, 1, white_ip))
connection.commit()
 connection.close()

When you run this script crashes error 'Connection' object has no attribute 'commit' , although the data in the database are recorded. What's the problem? Tried instead of connection.commit() to register the engine.commit(). But the error changed to 'Engine' object has no attribute 'commit'. Just tried before connection.commit() to register the connection.begin () but also nothing.
April 3rd 20 at 18:49
1 answer
April 3rd 20 at 18:51
Solution
In this case, connection.commit() is not necessary to write. Without it running.

Find more questions by tags MySQLPythonSQLAlchemy