2018-03-27 11:32:17 -04:00
|
|
|
import datetime
|
|
|
|
from sqlalchemy import create_engine
|
|
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from tabledef import *
|
2018-03-27 11:28:16 -04:00
|
|
|
|
2018-03-27 11:30:24 -04:00
|
|
|
engine = create_engine('sqlite:///tutorial.db', echo=True)
|
2018-03-27 11:28:16 -04:00
|
|
|
|
2018-03-27 11:32:17 -04:00
|
|
|
# create a Session
|
|
|
|
Session = sessionmaker(bind=engine)
|
|
|
|
session = Session()
|
2018-03-27 11:28:16 -04:00
|
|
|
|
2018-03-27 11:32:17 -04:00
|
|
|
user = User("admin","password")
|
|
|
|
session.add(user)
|
2018-03-27 11:28:16 -04:00
|
|
|
|
2018-03-27 11:32:17 -04:00
|
|
|
user = User("python","python")
|
|
|
|
session.add(user)
|
2018-03-27 11:28:16 -04:00
|
|
|
|
2018-03-27 11:32:17 -04:00
|
|
|
user = User("jumpiness","python")
|
|
|
|
session.add(user)
|
|
|
|
|
|
|
|
# commit the record the database
|
|
|
|
session.commit()
|
|
|
|
|
|
|
|
session.commit()
|