Upload files to "source/DataBank"
This commit is contained in:
55
source/DataBank/createDatabank.py
Normal file
55
source/DataBank/createDatabank.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import sqlalchemy as db #somehow pyodbc does not work in container
|
||||
from sqlalchemy.sql import text
|
||||
from sqlalchemy_utils import database_exists, create_database
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
creates the table Mitarbeiter
|
||||
IN:
|
||||
the cursor/engine which is the connection object to the db
|
||||
'''
|
||||
def createMitarbeiter(cursor):
|
||||
#write the SQL command to create the table
|
||||
create = text('''CREATE TABLE IF NOT EXISTS "Mitarbeiter"
|
||||
(
|
||||
kuerzel varchar(50) primary key,
|
||||
vorName varchar(50),
|
||||
nachName varchar(50),
|
||||
geschaeftsStelle varchar(50),
|
||||
eintrittsDatum date,
|
||||
eMail varchar(50),
|
||||
telefonNummer int
|
||||
)''')
|
||||
cursor.execute(create)
|
||||
cursor.commit()
|
||||
|
||||
|
||||
'''
|
||||
deletes the table Mitarbeiter
|
||||
IN:
|
||||
the cursor/engine which is the connection object to the db
|
||||
'''
|
||||
def dropMitarbeiter(cursor):
|
||||
#write the SQL command to create the table
|
||||
create = text('''DROP TABLE IF EXISTS "Mitarbeiter" ''')
|
||||
cursor.execute(create)
|
||||
cursor.commit()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user