Xiongyi Gao Posted June 15, 2016 Share Posted June 15, 2016 Hi All, My project requires to provide data entries and allow users to key in new values and insert rows into database using Spotfire. I'm trying to use IronPython to solve it but I don't know what should I use for the client type and connection string in the following code. I can find sample code for Oracle and SQL database, but how about Greenplum database Is there any way I can write back new data to this database Here is my code, but it doesn't work: from System import Array,String,Object from System.IO import Path, File, StreamWriter from Spotfire.Dxp.Data import DataTableSaveSettings from Spotfire.Dxp.Data.Import import TextFileDataSource from Spotfire.Dxp.Data.Import import TextDataReaderSettings from Spotfire.Dxp.Application.Visuals import TablePlot from Spotfire.Dxp.Application.Visuals import VisualTypeIdentifiers from Spotfire.Dxp.Data.Import import DatabaseDataSource from Spotfire.Dxp.Data.Import import DatabaseDataSourceSettings sqlCommand="INSERT INTO test.test(account,name) VALUES('10019','test');" dbsettings=DatabaseDataSourceSettings( "System.Data.SqlClient","Server=myServer;Database=myDs;UID=myID;PWD=myPWD",sqlCommand) ds = DatabaseDataSource(dbsettings) newDataTable = Document.Data.Tables.Add("temp",ds) Document.Data.Tables.Remove(newDataTable) Thanks. Link to comment Share on other sites More sharing options...
Manish Patel 2 Posted June 15, 2016 Share Posted June 15, 2016 As far as the ironPython is concerned, everything looks good. For DB settings (Connection string and classname), please check with your DBA. It depends on the driver you are using. e.g. class name:org.postgresql.Driver Link to comment Share on other sites More sharing options...
Andrew Berridge Posted June 15, 2016 Share Posted June 15, 2016 Hi - actually you need to find the correct .NET data source provider name. Please look at the API documentation for: DatabaseDataSourceSettings for further documentation on how to connect to the database using this approach. Andrew (TIBCO Data Science Team) Link to comment Share on other sites More sharing options...
Xiongyi Gao Posted June 16, 2016 Author Share Posted June 16, 2016 Thank you for your help. It works after I looked up for the .NET data provider and installed it. Thanks a lot. Link to comment Share on other sites More sharing options...
Brittany Wiechelman Posted December 18, 2019 Share Posted December 18, 2019 I am also looking to write back to Greenplum. What was the .net data source provider name that was used Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now