region.py 1.2 KB

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from sqlalchemy import Integer, Column, String, Float, UniqueConstraint, Index
  4. from db.base import Base
  5. class Region(Base):
  6. id = Column(Integer, primary_key=True, autoincrement=True, comment="ID")
  7. code = Column(String(20), nullable=False, comment="区域编码")
  8. name = Column(String(40), nullable=False, comment="区域名称")
  9. pcode = Column(String(20), default="100000", comment="上级区域编码")
  10. shortname = Column(String(40), comment="区域简称")
  11. level = Column(
  12. Integer,
  13. comment="地区级别,1:省/直辖市/自治区,2:地级市/地区/自治州/盟,3:市辖区/县级市/县,4:乡/镇,5:村")
  14. citycode = Column(String(20), default="", comment="区号")
  15. zipcode = Column(String(20), default="", comment="邮政编码")
  16. mergename = Column(String(100), default="", comment="组合名称")
  17. lng = Column(Float, default=0, comment="经度")
  18. lat = Column(Float, default=0, comment="纬度")
  19. pyname = Column(String(100), default="", comment="拼音名称")
  20. __table_args__ = (UniqueConstraint("code", name="uix_region_code"),
  21. Index("idx_region_name", "name"))