如何在 Python 中使用 Qt 数据库?
我从 PyQt 开始,听说 Qt 附带了一个名为 QtSQL 的特殊数据库模块。该模块的文档与 Qt 中的所有内容一样,仅涵盖 C++ 用法。在我的工作中,我需要一个可以同时被多个软件访问的数据库(本地网络)。我想知道是否有人使用 QtSQL 并可以提供一些如何了解更多信息的提示。是否可以在本地网络中使用它?安装 PyQt4 后它就可以使用了还是我需要安装更多东西?那么许可证呢?
I'm beginning with PyQt and heard that the Qt comes with a special data base module named QtSQL. The docs of the module, like everything in Qt, cover only C++ usage. In my work, I'll need a data base which can be accessed by more than one software by the time (local network). I would like to know if someone works with the QtSQL and could give some tips of how to learn more about it. Is it possible to work with it in local network? Is it ready-to-use when the PyQt4 is installed or do I need to install something more? And what about the license?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,
PyQt
支持QtSql.请注意,它本身不是数据库,而是数据库库的统一接口:
因此,您应该将其与现有数据库(例如 MySql)绑定。请注意,Python 也有自己的可用数据库 API,因此您可以在此处进行选择。
PyQt
的许可证是 GPL。至于如何了解更多信息,我建议首先总体了解数据库,并尝试了解您的需求以及满足这些需求需要什么数据库。一旦理解了这一点,选择 Python DB 绑定应该很容易。
Yes,
PyQt
supportsQtSql
. Note that it's not a database in itself, but rather a unified interface to database libraries:So you should tie it in to an existing database such as MySql. Note that Python also has its own APIs for databases available, so you'll have a choice here.
The license for
PyQt
is GPL.As for how to learn more about it, I would suggest to first learn about databases in general and try to understand your requirements and what DB you need to fulfill them. Once you understand that, picking the Python DB binding should be easy.