Skip to content

zlict/ksh_wg_mariadb_adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MariaDB Adapter for Python

Not for use in production

Usage

Connect

db = ksh_wg_mariadb_adapter.connect("lernumgebung_mariadb-server", "root", "mariadb", datenbank)

if db.test():
  print("Hurra! Die Verbindung zur Datenbank klappt :)")
else: 
  print("Uups! Da ging noch was schief :(")

Select

List tables:

tabellen = db.tables()
print(tabellen)

Select all data from a table:

daten = db.select("noten")
print(daten)

Condition:

daten = db.select("noten", where="note > 5")

Order:

daten = db.select("noten", order_by="note ASC")
daten = db.select("noten", order_by="note ASC, name DESC")

Insert

new_tupel = { "name": "Hans Muster", "note": 5.5 }
db.insert("noten", new_tupel)

Update

changes = { "name": "Hans Muster", "note": 4.5 }
db.update("noten", changes, where="id = 1")

Delete

db.delete("noten", where="id = 1")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages