-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
27 lines (22 loc) · 702 Bytes
/
setup.py
File metadata and controls
27 lines (22 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sqlite3
# Verbindung zur Datenbank (die Datei wird erstellt, wenn sie noch nicht existiert)
conn = sqlite3.connect('lager.db')
# Erstelle einen Cursor zum Ausführen von SQL-Befehlen
cursor = conn.cursor()
# Erstelle die Tabelle 'lager', falls sie noch nicht existiert
cursor.execute('''
CREATE TABLE IF NOT EXISTS lager (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
menge INTEGER NOT NULL,
preis REAL NOT NULL,
bild TEXT NOT NULL,
beschreibung TEXT NOT NULL,
lagerort TEXT NOT NULL,
stat_sheet TEXT NOT NULL
)
''')
# Schließe die Verbindung zur Datenbank
conn.commit()
conn.close()
print("Datenbank und Tabelle wurden erfolgreich erstellt!")