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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# -*- encoding: utf-8 -*-
'''
@File : models.py
@License : (C)Copyright 2018-2022
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2023/4/17 16:43 zart20 1.0 None
'''
from sqlalchemy import Column , Integer , String , DateTime
from database import *
class User ( Base ) :
__tablename__ = " users "
id = Column ( Integer , primary_key = True )
name = Column ( String ( 50 ) , unique = True )
email = Column ( String ( 120 ) , unique = True )
def __init__ ( self , name = None , email = None ) :
self . name = name
self . email = email
def __repr__ ( self ) :
# 有一个内置的函数叫 repr, 它能把一个对象用字符串的形式表达出来以便辨认
return f ' <User { self . name !r} > '
class City_Info ( Base ) :
__tablename__ = " city_info "
id = Column ( Integer , primary_key = True )
province = Column ( String ( 120 ) , nullable = False )
cityname = Column ( String ( 120 ) , nullable = False )
usernumber = Column ( Integer , default = 0 )
def __init__ ( self , province = None , cityname = None , usernumber = None ) :
self . province = province
self . cityname = cityname
self . usernumber = usernumber
def __repr__ ( self ) :
return f " <cityname { self . cityname !r} province { self . province !r} > "