Created
May 3, 2022 20:08
-
-
Save Derrick-Sherrill/8266887036b3478010b29e0718beff9d to your computer and use it in GitHub Desktop.
insert statements using in video tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pull in .secrets | |
import os | |
import mysql.connector | |
mydb = mysql.connector.connect( | |
host='nnsgluut5mye50or.cbetxkdyhwsb.us-east-1.rds.amazonaws.com', | |
user=os.environ.get('user'), | |
password=os.environ.get('password'), | |
port=3306, | |
database='jsfaxdu1coljgpvy' | |
) | |
# sql = "CREATE TABLE customers (name VARCHAR(255), address VARCHAR(255))" | |
mycursor = mydb.cursor() | |
# Begin insert Statements | |
sql = "INSERT INTO customers (name, address) VALUES (%s, %s)" | |
val = ("John", "Highway 21") | |
mycursor.execute(sql, val) | |
mydb.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment