推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
aoscici2000
V2EX  ›  Python

peewee PrimaryKeyField 如何设置自增开始值

  •  
  •   aoscici2000 · Jul 30, 2019 · 2718 views
    This topic created in 2508 days ago, the information mentioned may be changed or developed.
    
    class Article(BaseModel):
        id = PrimaryKeyField()
        author = CharField()
        content = TextField()
    
        class Meta:
            db_table = 'article'
            
    

    如题, 想让 id 从 10000 开始自增, 请问下在哪设置?

    1 replies    2019-07-30 09:08:13 +08:00
    mywaiting
        1
    mywaiting  
       Jul 30, 2019   ❤️ 1
    peewee 好像不支持这个自增起始值的设置?我翻过它的源代码,好像没有地方可以设置的

    可以在建库后,自己在数据库里面执行 SQL 语句指定自增起始值
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1033 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 22:52 · PVG 06:52 · LAX 15:52 · JFK 18:52
    ♥ Do have faith in what you're doing.