gpt4 book ai didi

python - sqlite3 : safe multitask read & write - how to?

转载 作者:太空宇宙 更新时间:2023-11-03 15:22:59 25 4
gpt4 key购买 nike

我有两个程序:第一个只写入 sqlite 数据库,第二个只读。我可以确定永远不会有一些错误吗?或者如何避免它(在 python 中)?

最佳答案

是的,它通常是安全的。

According to the SQLite FAQ :

Multiple processes can have the same database open at the same time. Multiple processes can be doing a SELECT at the same time. But only one process can be making changes to the database at any moment in time, however.

因为只有一个进程在写入,所以这没问题。

异常(exception):如果您的 .sqlite 文件存储在网络驱动器(Windows 或 NFS)上,这可能会中断。

关于python - sqlite3 : safe multitask read & write - how to?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12046760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com