Update login.py

This commit is contained in:
Logan Hunt 2018-03-27 09:32:17 -06:00 committed by GitHub
parent 1945dbe65c
commit a4c07273d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,26 +1,24 @@
from sqlalchemy import * import datetime
from sqlalchemy import create_engine, ForeignKey from sqlalchemy import create_engine
from sqlalchemy import Column, Date, Integer, String from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base from tabledef import *
from sqlalchemy.orm import relationship, backref
engine = create_engine('sqlite:///tutorial.db', echo=True) engine = create_engine('sqlite:///tutorial.db', echo=True)
Base = declarative_base()
######################################################################## # create a Session
class User(Base): Session = sessionmaker(bind=engine)
"""""" session = Session()
__tablename__ = "users"
id = Column(Integer, primary_key=True) user = User("admin","password")
username = Column(String) session.add(user)
password = Column(String)
#---------------------------------------------------------------------- user = User("python","python")
def __init__(self, username, password): session.add(user)
""""""
self.username = username
self.password = password
# create tables user = User("jumpiness","python")
Base.metadata.create_all(engine) session.add(user)
# commit the record the database
session.commit()
session.commit()