1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- from sqlalchemy import Integer, Column, String, Float, UniqueConstraint, Index
- from db import BaseORMModel
- class Region(BaseORMModel):
- __tablename__ = "regions"
- 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), default="", comment="区域简称")
- level = Column(Integer,
- nullable=False,
- 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"),
- )
|