简体   繁体   English

如何在 SQL Server 2014 中使用 python

[英]how to use python inside SQL server 2014

I have some experience with SQL and python.我对 SQL 和 python 有一些经验。

In one of my SQL stored procedures I want to use some python code block and some functions of python numpy.在我的一个 SQL 存储过程中,我想使用一些 python 代码块和 python numpy 的一些函数。

What is the best way to do it.SQL server version is 2014.最好的方法是什么。SQL 服务器版本是 2014。

First install the MySQL connector for python from the MySQL website and then import the mysql.connector module and initialize a variable to a mysql.connector.connect object and use cursors to modify and query data.首先从 MySQL 网站安装 MySQL 连接器 for python,然后导入mysql.connector模块并将变量初始化为mysql.connector.connect对象,并使用游标来修改和查询数据。 Look at the documentation for more help.查看文档以获得更多帮助。

If you don't have problem with no networking capabilities and less concurrency use sqlite, it is better than MySQL in these cases.如果您没有网络功能和并发性较低的问题,请使用 sqlite,在这些情况下,它比 MySQL 更好。

This article explains a rather tortuous means of calling Python routines via xp_cmdshell, for versions of SQL Server prior to the introduction of the sp_execute_external_script command in SQL Server 2016. I haven't tried it yet but it appears to be a rather difficult process. 本文解释了在 SQL Server 2016 中引入 sp_execute_external_script 命令之前的 SQL Server 版本,通过 xp_cmdshell 调用 Python 例程的一种相当曲折的方法。我还没有尝试过,但它似乎是一个相当困难的过程。 I don't believe the author listed the editions he verified the workaround on either.我不相信作者列出了他验证解决方法的版本。 Good luck.祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM