Following the example code for Update, we have this against one of our Hive transactional datastores:
PrestoDataAdapter dataAdapter = new PrestoDataAdapter("SELECT _id, name FROM hive.transactional_schema.[TableName]", connection); dataAdapter.UpdateCommand = new PrestoCommand( "UPDATE hive.transactional_schema.[TableName] SET name = @name " + "WHERE _id = @_id", connection); dataAdapter.UpdateCommand.Parameters.Add(new PrestoParameter("@name", "name", DbType.String)); dataAdapter.UpdateCommand.Parameters.Add(new PrestoParameter("@_id", "_id", DbType.String)); dataAdapter.UpdateCommand.Parameters[1].SourceVersion = DataRowVersion.Original; DataTable table = new DataTable(); dataAdapter.Fill(table); DataRow firstrow = table.Rows[0]; firstrow["name"] = firstrow["name"] + "-Updated"; dataAdapter.Update(table);
firstrow shows the updated name property, but the query that gets sent to Trino is:
UPDATE "hive"."transactional_schema".[TableName] SET "name" = 'name' WHERE "_id" = '_id'
so I guess I don’t understand how PrestoParameter is meant to work…from the example it looked like it was meant to map the property value (e.g. “name-Updated”) to the query parameter (e.g. @name), but it looks like it’s just passing in the 2nd param of PrestoParameter (e.g. “name”) as the value in the query.