Hi,
I have a couple of questions which I hope someone might be able to help me with
- Is there a way to identify the names of columns that are keyed in a table?
tmem:([dt:date$ 2014.02.13 2014.02.14];bid:
float$1.283 1.387)
meta tmem
c | t f a
—| -----
dt | d
bid| f
I can see in this example the data type but no definition that dt is keyed.
2) Is there a way to identify a table that is splayed? I can use .Q.qp to identify a partitioned table but I don’t anyway to identify a splayed and non splayed tables
tmem:(dt:date$ 2014.02.13 2014.03.13;bid:
float$1.283 1.387)
.Q.pq tmem
0b
`:c:/q/splay/tsplay/ set tmem
\l c:/q/splay
.Q.qp tsplay
0b
This information is useful for some python classes I am writing to automatically insert data into a normal, splayed or partitioned tables.
Many thanks
David
Ad.1: Knowing that t is a keyed table (99h=type t) you can do cols key t.
Ad.2: .Q.qp function reference says 1b if given a partitioned table, 0b if given a splayed table, and 0 for anything else.
HTH,
Pawel Tryfon
2014-02-18 10:07 GMT+01:00 David Bieber <david.bieber@gmail.com>:
Hi,
I have a couple of questions which I hope someone might be able to help me with
- Is there a way to identify the names of columns that are keyed in a table?
tmem:([dt:date$ 2014.02.13 2014.02.14];bid:
float$1.283 1.387)
meta tmem
c | t f a
—| -----
dt | d
bid| f
I can see in this example the data type but no definition that dt is keyed.
2) Is there a way to identify a table that is splayed? I can use .Q.qp to identify a partitioned table but I don’t anyway to identify a splayed and non splayed tables
tmem:(dt:date$ 2014.02.13 2014.03.13;bid:
float$1.283 1.387)
.Q.pq tmem
0b
`:c:/q/splay/tsplay/ set tmem
\l c:/q/splay
.Q.qp tsplay
0b
This information is useful for some python classes I am writing to automatically insert data into a normal, splayed or partitioned tables.
Many thanks
David
--
Submitted via Google Groups
I have just realized how to answer my first question
cols (key tmem)
`dt
cols (value tmem)
`bid
David
keys <table name>
Should give you the list of primary key col names