From 67c7d20b1bd42bffe741312ed541de993e7993e6 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Sun, 7 May 2023 10:26:58 +0200 Subject: [PATCH] working directory db --- db/.gitignore | 3 +++ db/connectdb.py | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 db/.gitignore create mode 100644 db/connectdb.py diff --git a/db/.gitignore b/db/.gitignore new file mode 100644 index 0000000..94a378f --- /dev/null +++ b/db/.gitignore @@ -0,0 +1,3 @@ +./__pycache__ +*.log +./network/__pycache__/* diff --git a/db/connectdb.py b/db/connectdb.py new file mode 100644 index 0000000..e5086e4 --- /dev/null +++ b/db/connectdb.py @@ -0,0 +1,10 @@ +import mysql.connector +import logging + +logging.basicConfig( format='%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s', level=logging.DEBUG) + +mydb = mysql.connector.connect(host='database', user='ploeger',password='SW_Ep.6:ROTJ',database='weather') +logging.debug(f'Datenbankverbindung aufgebaut ${mydb}') +mycursor = mydb.cursor() +logging.debug(f'Cursor gesetzt ${mycursor}') +