28 lines
531 B
Python
28 lines
531 B
Python
#! /usr/bin/env python3
|
|
#
|
|
#Benötigt python3-pymysql
|
|
# mysql -h notebook14 -u python -pvilla inventory
|
|
import sys
|
|
import pymysql
|
|
|
|
from utilities import hide_exception
|
|
|
|
def db_connect(credentials: dict):
|
|
connection = pymysql.connect(**credentials)
|
|
return connection
|
|
|
|
# Passwort aus Konfigiruationsdaten lesen
|
|
credentials = dict(
|
|
host = 'notebook14',
|
|
user = 'python',
|
|
password = 'villa',
|
|
database = 'inventory'
|
|
)
|
|
|
|
#Connection
|
|
def main():
|
|
db = db_connect(credentials)
|
|
db.close()
|
|
|
|
|
|
hide_exception(main) |