Python PyMySQL Tutorial 3 : Insert Records Into MySQL Database

preview_player
Показать описание
Python PyMySQL Tutorial 3 : Insert Records Into MySQL Database

How To Insert Records Into MySQL Database using Python Program in Ubuntu Linux
Рекомендации по теме
Комментарии
Автор

what we can do further after this? I mean work with large database, this is generating .ibd file so how it can be use, where we can show database as table form, why database not generating in .sql file to connect with workbench?

richiestark
Автор

It is showing not all parameters filled error in windows 10

Yuri_Manhwa
Автор

why my input name, get error? file <string> ???

kyaelectronics
Автор

import pymysql

connection = pymysql.connect("localhost", "root", "acer", "devtech")
cursor = connection.cursor()

name = input("Enter your name: ")

insert_query = """insert into employee(name)('%s')"""\
%(name)

try:
cursor.execute(insert_query)
# commiting to the database, i.e. saving the records inserted
connection.commit()
print("Name is successfully inserted!")

except Exception as e:
connection.rollback()
print("Exception Occurred: ", e)

# close db connection

connection.close()


This is my code (same as yours). I am getting the following error:
Exception Occurred: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''raya')' at line 1")


I am very new to mysql.

rayadastidar
Автор

How can we insert a dataframe in mysql..?

hemantsah
visit shbcf.ru