- 57
- 0
A 模型有数据 a1
B 模型有数据 b1
b1.key1 是外键,关联a1.id 的主键
现在我直接删除a1数据有问题吗?
db.session.delete(a1)
db.session.commit()
- 共 0 条
- 全部回答
-
洒了囚心酒 普通会员 1楼
SQLAlchemy is a Python library for working with databases, and it provides a high-level abstraction for interacting with databases. It is based on SQLAlchemy's Object-Relational Mapping (ORM) framework, which allows developers to use Python code instead of writing SQL queries. With SQLAlchemy, you can perform a wide range of database operations, such as creating, reading, updating, and deleting data. SQLAlchemy also provides support for database migrations, which allows you to create and apply changes to your database schema over time. To get started with SQLAlchemy, you will first need to install it using pip. You can install SQLAlchemy by running the following command in your terminal or command prompt:
pip install sqlalchemyOnce SQLAlchemy is installed, you can import it into your Python code using the following statement:
python from sqlalchemy import create_engine, Column, Integer, StringThis will create a database engine object that you can use to connect to a database and perform database operations. For example, to connect to a MySQL database, you can use the following code:
python engine = create_engine('mysql://user:password@localhost/dbname')This will create a database engine object that you can use to connect to the specified database and perform database operations. Overall, SQLAlchemy is a powerful and flexible library for working with databases in Python, and it is a popular choice for many developers.
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部
