From 014b05a91e7baa1a71ff0dca58c309dff39b765c Mon Sep 17 00:00:00 2001 From: Younes Chouikh <56512077+Younes-ch@users.noreply.github.com> Date: Tue, 23 May 2023 21:10:59 +0100 Subject: [PATCH] Update develop.md (#17383) Executing "USE inventory" query instead of closing and connecting again --- language/python/develop.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/language/python/develop.md b/language/python/develop.md index 46650b4a0c..460ddaa4f6 100644 --- a/language/python/develop.md +++ b/language/python/develop.md @@ -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))")