Jms
Jms

Reputation: 159

(q/kdb+) Delete column from tables saved in disk

I have the following table saved in the disk

`:t/ upsert ([] v1:10 20 30; v2:1.1 2.2 3.3; v3:1 2 3)

how can I delete column v3 for instance?

Upvotes: 0

Views: 817

Answers (3)

Joe Griffiths
Joe Griffiths

Reputation: 381

dbmaint.q is another option: https://github.com/KxSystems/kdb/blob/master/utils/dbmaint.q

This includes the function delete1col for this purpose. This can be used as so:

delete1col[tabledir;col]

in your case this would be:

delete1col[`:t/;`v3]

This script also includes a whole host of other functionality you may find useful in the future.

Upvotes: 4

Cathal O'Neill
Cathal O'Neill

Reputation: 3179

The following should work

`:t/ set delete v3 from t

Upvotes: 2

R. Laidler
R. Laidler

Reputation: 649

This line should achieve what you are looking to do:

`:/t/.d set `v1`v2

Additionally, you should delete your v3 file.

Hope that helps!

Upvotes: 2

Related Questions