pymysql create static

Estimated reading: 1 minute 345 views

Python Create Static Operation.

here everything will be same , expect we are not taking anything from the database.
Rather we are putting the data to the database.

commit() Method. This method sends a COMMIT statement to the MySQL server, committing the current transaction.
Since by default Connector/Python does not autocommit,
it is important to call this method after every transaction that modifies data for tables that use transactional storage engines.

				
					import pymysql


conn = pymysql.connect(
        host='localhost',
        user='root',
        password="12345",
        db='sakila',
)

cur = conn.cursor()
str1_query = "create table teacher3(id int , name char(20))"
cur.execute(str1_query)
conn.commit()
print("table created sucessfully")
conn.close()
				
			

Leave a Comment

CONTENTS