推荐学习书目
› 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
galtjay
V2EX  ›  Python

sqlalchemy2.0 简明介绍 解决 1.4 报错的问题

  •  1
     
  •   galtjay · Apr 25, 2023 · 1658 views
    This topic created in 1248 days ago, the information mentioned may be changed or developed.
    目前当你使用 pip 安装 sqlalchemy 的包时,默认安装的版本已经是 2.0 版本了。因此假定你使用 1.4 时期的定义模型的方法,会直接报错;
    TypeError: declarative_base() takes 0 positional arguments but 1 was given

    解决方法和基础介绍详见,
    https://watermelonwater.tech/sqlalchemy2-0%e7%ae%80%e6%98%8e%e4%bb%8b%e7%bb%8ddeclarative_base-%e6%8a%a5%e9%94%99%e8%a7%a3%e5%86%b3/
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 22:45 · PVG 06:45 · LAX 15:45 · JFK 18:45
    ♥ Do have faith in what you're doing.