You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
693 B
21 lines
693 B
|
1 week ago
|
from sqlalchemy import Column, Integer, String
|
||
|
|
from sqlalchemy.ext.declarative import declarative_base
|
||
|
|
|
||
|
|
Base = declarative_base()
|
||
|
|
|
||
|
|
|
||
|
|
# 定义映射类User,其继承上一步创建的Base
|
||
|
|
class Qrcode(Base):
|
||
|
|
# 指定本类映射到users表
|
||
|
|
__tablename__ = 'qrcode'
|
||
|
|
|
||
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||
|
|
# 指定name映射到name字段; name字段为字符串类形,
|
||
|
|
qrcode = Column(String(200))
|
||
|
|
used = Column(String(10))
|
||
|
|
|
||
|
|
# __repr__方法用于输出该类的对象被print()时输出的字符串,如果不想写可以不写
|
||
|
|
def __repr__(self):
|
||
|
|
return "<qrcode(qrcode='%s', used='%s')>" % (
|
||
|
|
self.qrcode, self.used)
|