Python:将数据批量插入SQL Server
我想快速将数据放入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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
平面文件解决方案将是最简单的解决方案,但如果您确实需要替代方案,那么您也许可以使用
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.