http://code.kx.com/wiki/Cookbook/LoadingFromLargeFiles<o:p></o:p>
<o:p> </o:p>
HTH,<o:p></o:p>
Kim<o:p></o:p>
<o:p> </o:p>
Von: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] Im Auftrag von Gregorio Occhiogrosso
Gesendet: Samstag, 15. Dezember 2012 21:41
An: personal-kdbplus@googlegroups.com
Cc: kdb@ryan-h.com
Betreff: Re: [personal kdb+] insert lists of lists<o:p></o:p>
<o:p> </o:p>
Hi, this work but now i have another problem XD.<o:p></o:p>
The file csv has a lot of row and this occupies a lot of RAM, 1.5 GB.<o:p></o:p>
is there a way to work ram and hard drive together?<o:p></o:p>
sorry for all this questions but i’am new whit this software.
Il giorno gioved? 13 dicembre 2012 16:07:42 UTC+1, Markus Himmerich ha scritto:<o:p></o:p>
Hi, <o:p></o:p>
<o:p> </o:p>
if your csv is “c:/t2.csv” and contains the data of Ryan’s example:<o:p></o:p>
1|3|10<o:p></o:p>
2|4|20 <o:p></o:p>
<o:p> </o:p>
/ Read the file into a list, separate it and flip it.<o:p></o:p>
list:flip “|” vs/: read0 `:c:/t2.csv<o:p></o:p>
/ Now list[0] and list[1] contains the primary key columns of t1.<o:p></o:p>
/ Cast the two columns in pairs to the enum of the t1 primary key:<o:p></o:p>
list[1]:`t1$flip(“I”$list[0];“I”$list[1])<o:p></o:p>
/ Throw away the first element of the list<o:p></o:p>
list:1_list<o:p></o:p>
/ and insert it:<o:p></o:p>
`t2 insert list<o:p></o:p>
<o:p> </o:p>
Hope this helps,<o:p></o:p>
Markus<o:p></o:p>
Am Donnerstag, 13. Dezember 2012 11:08:56 UTC+1 schrieb Gregorio Occhiogrosso:<o:p></o:p>
Tnx it work but i have another problem: <o:p></o:p>
if i have a csv whit 3 columns, how will i insert a csv in table t2??<o:p></o:p>
<o:p> </o:p>
Il giorno mercoled? 12 dicembre 2012 17:27:59 UTC+1, Ryan Hamilton ha scritto:<o:p></o:p>
Hi,
Is this what you want?
q)t1:([c1:1 2; c2:3 4] col3:5 6)
q)t2:( c4:`t1$(); c5:())
q)meta t2
q)/ use nested list of keys, cast to the table name to create link
q)t2 insert ([] c4:
t1$(1 3;2 4); c5:10 20)
0 1
q)update c4.c1,c4.c2,c4.col3 from t2
c4 c5 c1 c2 col3
0 10 1 3 5
1 20 2 4 6<o:p></o:p>
Also I would avoid underscore in variable names as it’s a built-in an operator.
Regards,
Ryan
<o:p></o:p>
From : “Gregorio Occhiogrosso” <occhiogros…@gmail.com>
Sent : Wednesday, December 12, 2012 3:33 PM
To : personal…@googlegroups.com
Subject : [personal kdb+] insert lists of lists
hello, <o:p></o:p>
<o:p> </o:p>
i have a problem. I have 2 table:<o:p></o:p>
<o:p> </o:p>
table_1:([col1:(); col2:()] col3:())<o:p></o:p>
table_2:(col1:table_1$(), col2:())<o:p></o:p>
<o:p> </o:p>
how i insert data into table_2?<o:p></o:p>
<o:p> </o:p>
tnx<o:p></o:p>
–
Submitted via Google Groups