V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2023-04-25 11:13:10 +08:00 · 891 次点击
    这是一个创建于 418 天前的主题,其中的信息可能已经有所发展或是发生改变。
    目前当你使用 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/
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2491 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 07:03 · PVG 15:03 · LAX 00:03 · JFK 03:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.