Removing quotation from a column name

https://learninghub.kx.com/forums/topic/removing-quotation-from-a-column-name

I have a table with a column name called "upload_date*". I'm trying to remove the quotes and the star by renaming the column with xcol but having trouble trying to write the syntax for removing the quotes. Anyone have any ideas for this?

I have something like

h_feed "table_name ( ` $""upload_date*"")"

the backslashes to escape the quotes but doesn't seem to be working.

The syntax for xcols is `newName xcol tableName , because it looks like you are sending the query over a handle you have to do either h_feed "`newName xcol tableName" or h_feed(xcol;`newName;tableName)

Note that xcol renames the first column to the first symbol. so if your update_date is at position n you need n-1 column names before on the left side. Not sure if that makes sense but you can read the documentation about xcol here https://code.kx.com/q/ref/cols/#xcol

You can also use .Q.id to sanitise your column names

(base) alexanderunterrainer@Alexanders-Laptop:~|⇒ cat table.csv

""update_date*"",goodName

1,2

3,4

5,6

q)t:("II";enlist csv) 0:`table.csv

q)t

"update_date*" goodName

-----------------------

1 2

3 4

5 6

q).Q.id t

update_date goodName

--------------------

1 2

3 4

5 6

or using xcol

q)`newGoodName xcol t

newGoodName goodName

--------------------

1 2

3 4

5 6

Reference for .Q.id

https://code.kx.com/q/ref/dotq/#id-sanitize

.Q.id was exactly what I was looking for. Thank you!