Spotfire 从脚本写入数据库的最快方法

Spotfire 从脚本写入数据库的最快方法,spotfire,Spotfire,SQL server写入脚本: sqlCommand = "INSERT INTO ... ds = DatabaseDataSource(DatabaseDataSourceSettings("System.Data.SqlClient","Server=xxx;Database=xxx;UID=xxx;PWD=xxx",sqlCommand)) #execute by creating a temp table with db source, then drop table newDat

SQL server写入脚本:

sqlCommand = "INSERT INTO ...

ds = DatabaseDataSource(DatabaseDataSourceSettings("System.Data.SqlClient","Server=xxx;Database=xxx;UID=xxx;PWD=xxx",sqlCommand))

#execute by creating a temp table with db source, then drop table
newDataTable = Document.Data.Tables.Add("temp",ds)
Document.Data.Tables.Remove(newDataTable)

然而,这种方法有一点延迟。不创建临时表就可以做到这一点吗?

很久以前我就想回答我自己的问题了。可以避免使用Spotfire库,并使用.NET System.Data.SqlClient,使用以下简单脚本可以更快地执行:

import clr, datetime
clr.AddReference('System.Data')
from System.Data import SqlClient
from System import Threading, DateTime

sql = "INSERT INTO ...."

conn = SqlClient.SqlConnection("Server=;Database=;UID=;PWD=")
conn.Open()

cmd = SqlClient.SqlCommand(sql, conn)
exe = cmd.ExecuteReader()

exe.Close()
conn.Close()

您是否考虑通过修改原始SQL和预置插入语句来使用参数化的信息链接?简要地说,您有一个例子吗?您认为这样会更快吗?如果您正试图这样做,您可以使用信息链接回写到数据库。只需使用更新前或更新后下的SQL按钮创建更新语句。确保使用查询选项将某些内容返回给Spotfie。单选按钮有误导性。它们应该是选项卡,因为您可能认为它将执行一个或多个,但不是全部。示例:更新dev.myTable set status=?status,comment_text=?comment,USERNAME=“%CURRENT_USER%”,其中itemId在(?selectedds)中,并在parameters部分下设置参数(如果有),这太神奇了!谢谢分享