python on sql
USE [DemoDb]
GO
execute sp_execute_external_script
@language = N'Python',
@script = N'
a = 1
b = 2
c = a/b
d = a*b
print(c, d)
'
execute sp_execute_external_script
@language = N'Python',
@script = N'
MyOutput = MyInput
',
@input_data_1_name = N'MyInput',
@input_data_1 = N'SELECT 1 as Col1',
@output_data_1_name = N'MyOutput'
WITH RESULT SETS ((ResultValue int))
execute sp_execute_external_script
@language = N'Python',
@script = N'
MyOutput = MyInput
',
@input_data_1_name = N'MyInput',
@input_data_1 = N'SELECT [customer]
,[orders]
,[items]
,[cost] FROM [DemoDb].[dbo].[Sales.Orders]',
@output_data_1_name = N'MyOutput'
WITH RESULT SETS (("CustomerID" int, "Orders" float,"Items" float,"Cost" float));
execute sp_execute_external_script
@language = N'Python',
@script = N'
a = 1
b = 2
c = a/b
print(c)
s = pandas.Series(c, index =["simple math example 1"])
print(s)
'
execute sp_execute_external_script
@language = N'Python',
@script = N'
import pandas as pd
a = 1
b = 2
c = a/b
d = a*b
s = pandas.Series([c,d])
print(s)
df = pd.DataFrame(s)
OutputDataSet = df
'
WITH RESULT SETS (( ResultValue float ))
python on sql的更多相关文章
- python 连接sql server
linux 下pymssql模块的安装 所需压缩包:pymssql-2.1.0.tar.bz2freetds-patched.tar.gz 安装: tar -xvf pymssql-2.1.0.tar ...
- Python和SQL Server 2017的强大功能
Python和SQL Server 2017的强大功能 摘要: 源:https://www.red-gate.com/simple-talk/sql/sql-development/power-pyt ...
- Python和SQL 2017的强大功能
Python和SQL Server 2017的强大功能 原文来自:https://www.red-gate.com/simple-talk/sql/sql-development/power-py ...
- [Spark][Python][DataFrame][SQL]Spark对DataFrame直接执行SQL处理的例子
[Spark][Python][DataFrame][SQL]Spark对DataFrame直接执行SQL处理的例子 $cat people.json {"name":" ...
- web实践小项目<一>:简单日程管理系统(涉及html/css,javascript,python,sql,日期处理)
暑假自学了些html/css,javascript和python,苦于学完无处练手几乎过目即忘...最后在同学的建议下做了个简单日程管理系统.借第一版完成之际,希望能将实践期间犯过的错误和获得的新知进 ...
- Python监控SQL Server数据库服务器磁盘使用情况
本篇博客总结一下Python采集SQL Server数据库服务器的磁盘使用信息,其实这里也是根据需求不断推进演化的一个历程,我们监控服务器的磁盘走了大概这样一个历程: 1:使用SQL Server作业 ...
- Python3.7.1学习(八) Python访问SQL Server数据库
一.pip install pymssql即可安装pymssql库 二.Python连接SQL Server数据库 实例代码如下: # -*- coding:utf-8 -*-"&q ...
- python防止sql注入的方法
python防止sql注入的方法: 1. 使用cursor.execute(sql, args)的参数位: sql_str = "select * from py_msgcontrol.py ...
- 使用python执行sql语句和外键解析
一.下载并导入pymysql pip install pymysql && import pymysql db=pymysql.connect(host=) #如果报错host大概率因 ...
- python操作SQL
pymysql pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同 一.下载安装 pip3 install pymysql 二.操作使用 1.执行SQL #!/usr ...
随机推荐
- 3n+1猜想——模拟
package dxb.com; import java.util.Scanner; public class caixiang { public static void main(String[] ...
- linux kettle
https://blog.csdn.net/zzq900503/article/details/79110810
- Spark DateType cast 踩坑
前言 在平时的 Spark 处理中常常会有把一个如 2012-12-12 这样的 date 类型转换成一个 long 的 Unix time 然后进行计算的需求.下面是一段示例代码: val sche ...
- SSH三大框架的工作原理以及流程
Hibernate工作原理以及为什么要用 原理:1.通过Configuration().configure();读取并解析hibernate.cfg.xml配置文件2.由hibernate.cfg.x ...
- MVC模式笔记
参见:https://martinfowler.com/eaaCatalog/modelViewController.html 企业应用架构模式(P of EAA)第14章Web表现模式第一节MVC笔 ...
- FB面经prepare: 3 Window Max Sum
Given a num array, find a window of size k, that has a maximum sum of the k entries. follow-up: Find ...
- IconFont --阿里巴巴矢量库
超多的图标网站,可自己设置颜色,然后下载. IconFont --阿里巴巴矢量库
- 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.ContextLoaderListener] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class p
严重: 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.ContextLoaderListener]org.springframework ...
- C# Unity的使用
Unity是微软推出的IOC框架, 使用这个框架,可以实现AOP面向切面编程,便于代码的后期维护,此外,这套框架还自带单例模式,可以提高程序的运行效率. 下面是我自己的案例,以供日后参考: 使用VS2 ...
- ASP.NET gridview导出excel,防止繁体产生有乱码的方式
//1.先引用比如 : using System; using System.Collections.Generic; using System.Linq; using System.Web; usi ...