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