Re: [personal kdb+] Elementary loading

146 views
Skip to first unread message

Simon Garland

unread,
Apr 12, 2013, 8:18:25 AM4/12/13
to Kdb+ Personal Developers
it looks like you're calling get from the command prompt, not from within q 

within q your file specification is correct, and you'd use 0:

 C:\q>type data.csv
ll,f0,f1
111,222.2,333.3
1234,56.7,8.9

C:\q>q
KDB+ 3.1T 2013.04.03 Copyright (C) 1993-2013 Kx Systems
w64/ 1()core 1023MB Simon simon-w8 192.168.116.137 EXPIRE ..

q)("JFF";enlist",")0:`:c:/q/data.csv
ll   f0    f1
----------------
111  222.2 333.3
1234 56.7  8.9
q)

see:




On 12 April 2013 12:41, raytork <ray...@gmail.com> wrote:
I am running Windows Q on my SSD C: and want to load a csv file located at d:/q/data.csv which contains rows each with a long and two floats. I see examples in the Wiki and qfm, but none with a drive. I tried what seems obvious - d:/q/data.csv but get the error:
C:\q>get `:d:/q/data.csv
'get' is not recognized as an internal or external command,
operable program or batch file.

--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbpl...@googlegroups.com.
To post to this group, send email to personal...@googlegroups.com.
Visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ramon Torkelson

unread,
Apr 12, 2013, 10:25:07 AM4/12/13
to personal...@googlegroups.com
When I do the steps you show I get:

C:\q>w32\q
KDB+ 3.0 2012.12.22 Copyright (C) 1993-2012 Kx Systems
w32/ 8()core 4095MB Ray antec-pc 192.168.1.107  2013.03.22

'exp

C:\q>q
'q' is not recognized as an internal or external command,

Charles Skelton

unread,
Apr 12, 2013, 10:27:39 AM4/12/13
to personal...@googlegroups.com
'exp - that trial release has expired. Please download the latest from


thanks


Ray

unread,
Apr 12, 2013, 4:33:44 PM4/12/13
to personal...@googlegroups.com
Thanks for your assistance that worked; I am obviously new at this. 
I saved my table splayed with no problem but then keyed it on the long. Using set on that causes an error. Is there special syntax for storing keyed tables?

Paul Loughran

unread,
Apr 12, 2013, 5:59:54 PM4/12/13
to personal...@googlegroups.com
Hi Ray,

You can't save keyed tables as splayed, this is one of the limitations of splayed tables.

http://code.kx.com/wiki/JB:KdbplusForMortals/splayed_tables#1.2.0.2_Limitations_of_Splaying

Perhaps you might consider using a linked column, more information can be found here.

http://code.kx.com/wiki/JB:KdbplusForMortals/splayed_tables#1.2.8_Links_between_Splayed_Tables

Regards,
Paul



Charles Skelton

unread,
Apr 12, 2013, 6:04:22 PM4/12/13
to personal...@googlegroups.com
could also re-apply the key on the fly when mapping the splayed table
e.g.
q)t1:`a`b xkey select a,b,c from get`:t/

Ray

unread,
Apr 13, 2013, 1:41:02 PM4/13/13
to personal...@googlegroups.com
My work table will require 53gig. How do I build it directly to disk?

Charles Skelton

unread,
Apr 13, 2013, 2:44:34 PM4/13/13
to personal...@googlegroups.com
you can append to splayed tables using upsert

e.g.

`:splay/ upsert newData

Ramon Torkelson

unread,
Apr 14, 2013, 9:09:06 AM4/14/13
to personal...@googlegroups.com
Thanks for all your help.
I do not see in qfm or the wiki instructions for self or Cartesian joins or table aliasing. I attempted to use a view for this but did not succeed. In a self join, how can you refer to the identical columns in each joined table?

q)t:([] c:1 2 3; x:100 200 300;y:1000 2000 3000)
q)v::select c, x, y from t
q)t
c x   y
----------
1 100 1000
2 200 2000
3 300 3000
q)v
c x   y
----------
1 100 1000
2 200 2000
3 300 3000
q)select from t, v
c x   y
----------
1 100 1000
2 200 2000
3 300 3000
1 100 1000
2 200 2000
3 300 3000
q)select t.c, v.c from t, v
'type

Charles Skelton

unread,
Apr 14, 2013, 10:14:57 AM4/14/13
to personal...@googlegroups.com
there's an easily overlooked page on code.kx.com which summarizes the available joins in kdb+


Ray

unread,
Apr 14, 2013, 11:57:32 AM4/14/13
to personal...@googlegroups.com
Thanks for the reference. I was following the joins section in qfm and saw most of those, but as I understand the references none seems to supply the equivalent of a SQL Cartesian join. I'd expect 9 rows to result from a self join on my example table t.

Ryan Hamilton

unread,
Apr 14, 2013, 2:31:44 PM4/14/13
to personal...@googlegroups.com
Cartesian join: www.timestored.com/kdb-guides/qsql-inner-left-joins#nonstandard-sql-inner-join
Use xgroup to group all next lists for each key.
-- 
TimeStored.com - KDB+ Training, Consulting, Software

Charles Skelton

unread,
Apr 14, 2013, 2:48:23 PM4/14/13
to personal...@googlegroups.com
also have a look at cross

e.g.
q)([]date:2001.01.01+til 3)cross([]time:10:00 11:00)
date       time 
----------------
2001.01.01 10:00
2001.01.01 11:00
2001.01.02 10:00
2001.01.02 11:00
2001.01.03 10:00
2001.01.03 11:00

Ramon Torkelson

unread,
Apr 15, 2013, 6:11:40 AM4/15/13
to personal...@googlegroups.com
perfect, thanks so much!
Reply all
Reply to author
Forward
0 new messages