在python的aws rds中创建并插入表。它也显示输出,但未反映在RDS中。
import mysql.connector
myconn = mysql.connector.connect(host="testdb.cujdryz5rc3f.us- east-2.rds.amazonaws.com", port=3306, user="ninky", password="ninkyrds", database="Emp_info")
cur = myconn.cursor()
query = """insert into EMP_DETAIL(name,age,salary) values (%s,%s,%s)"""
value = [("deepak", 29, 6700)]
cur.executemany(query, value)
query2="select * from EMP_DETAIL"
cur.execute(query2)
for x in cur.fetchall():
print(x)
myconn.close()
output
--------
('deepak', 29, 6700)
如果有人对此提供帮助,那就太好了。