Skip to content

Commit 014b05a

Browse files
authored
Update develop.md (docker#17383)
Executing "USE inventory" query instead of closing and connecting again
1 parent aeb0906 commit 014b05a

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

language/python/develop.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,7 @@ def db_init():
121121

122122
cursor.execute("DROP DATABASE IF EXISTS inventory")
123123
cursor.execute("CREATE DATABASE inventory")
124-
cursor.close()
125-
126-
mydb = mysql.connector.connect(
127-
host="mysqldb",
128-
user="root",
129-
password="p@ssw0rd1",
130-
database="inventory"
131-
)
132-
cursor = mydb.cursor()
124+
cursor.execute("USE inventory")
133125

134126
cursor.execute("DROP TABLE IF EXISTS widgets")
135127
cursor.execute("CREATE TABLE widgets (name VARCHAR(255), description VARCHAR(255))")

0 commit comments

Comments
 (0)