old-src-backup/login.py

27 lines
836 B
Python
Raw Normal View History

2018-03-27 11:30:24 -04:00
from sqlalchemy import *
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Date, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
2018-03-27 11:28:16 -04:00
2018-03-27 11:30:24 -04:00
engine = create_engine('sqlite:///tutorial.db', echo=True)
Base = declarative_base()
2018-03-27 11:28:16 -04:00
2018-03-27 11:30:24 -04:00
########################################################################
class User(Base):
""""""
__tablename__ = "users"
2018-03-27 11:28:16 -04:00
2018-03-27 11:30:24 -04:00
id = Column(Integer, primary_key=True)
username = Column(String)
password = Column(String)
2018-03-27 11:28:16 -04:00
2018-03-27 11:30:24 -04:00
#----------------------------------------------------------------------
def __init__(self, username, password):
""""""
self.username = username
self.password = password
2018-03-27 11:28:16 -04:00
2018-03-27 11:30:24 -04:00
# create tables
Base.metadata.create_all(engine)