Update develop.md (#17383)

Executing "USE inventory" query instead of closing and connecting again
This commit is contained in:
Younes Chouikh 2023-05-23 21:10:59 +01:00 committed by GitHub
parent aeb09066ae
commit 014b05a91e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -121,15 +121,7 @@ def db_init():
cursor.execute("DROP DATABASE IF EXISTS inventory")
cursor.execute("CREATE DATABASE inventory")
cursor.close()
mydb = mysql.connector.connect(
host="mysqldb",
user="root",
password="p@ssw0rd1",
database="inventory"
)
cursor = mydb.cursor()
cursor.execute("USE inventory")
cursor.execute("DROP TABLE IF EXISTS widgets")
cursor.execute("CREATE TABLE widgets (name VARCHAR(255), description VARCHAR(255))")