Python:将数据批量插入SQL Server

发布于 2024-12-17 00:26:54 字数 285 浏览 4 评论 0原文

我想快速将数据放入sql server数据库中。是否可以访问 SqlBulkCopy?我知道 IronPython 可以做到这一点,而且我也知道我可以创建可以通过 T-SQL 加载的文本文件。但我更喜欢一个可以直接从 CPython 传递数据的解决方案。

I want to quickly put data into a sql server database. Is there a possibility to access the bulk copy functionality of SqlBulkCopy from CPython? I know it would be possible from IronPython and I also know that I could create text files which I could load via T-SQL. But I would prefer a solution where I can pass in data directly from CPython.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮光之海 2024-12-24 00:26:54

平面文件解决方案将是最简单的解决方案,但如果您确实需要替代方案,那么您也许可以使用 ctypes 来驱动 SQL Server ODBC 批量复制扩展

The flat file solution would be the simplest solution, but if you really need an alternative then you might be able to use ctypes to drive the SQL Server ODBC bulk copy extension.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文