Get Column Name from Query

Wanted to see if anyone out there had easy way to do what I am trying to do. I am not sure but I may be missing something. I have query returing and I want to be able to read the columnnames and use them as the tag names to insert the value to the tags. But cant seam to figure out how of if I can read the column names. Any ideas?

rs = system.db.runQuery("SELECT [equipment_value],Avg([milliseconds_cycle] / 1000)[Time_Cycle],Avg([angle_swing_out])[Swing_Angle]FROM [ACWSRV].[dbo].[data_dragline_cycle]WHERE [time_start] BETWEEN '2013/01/03' AND '2013/01/10'and equipment_value = 1 GROUP BY [equipment_value];") for row in rs: for col in row: colName = str(col) print colName system.tag.writeToTag('AccuWeigh/8750/AW_Interface/'+colName+'/Value_This_Shift_AVG', col )

Convert your PyDataSet to a Dataset and then use getColumnName on the dataset? rsDataset = system.dataset.toDataSet(rs) colName = rsDataset.getColumnName(index)

Worked like a champ.

thanks Pat

This would be nice additions to the pyDataSet to be able to get the metadata getColumnName and getColumnLabel would be nice.