Re: [sqlite] Joining tables in a single file
I think the attach is the way to go, but no need to insert, just select from the attached databases. sqlite3 master.db (master is empty). attach a.db A attach b.db B attach c.db C Then : select from a.A, b.b, c.c where Alberto Simões <[EMAIL PROTECTED]> wrote: Hi I am using SQLite to store ngrams from texts (bigrams, trigrams and tetragrams). This is not really important for the question; just imagine I have three tables A (int,int), B (int, int, int) and C (int, int, int, int). As the table keys are full rows and the tables get big, it is not quite efficient com compute bigrams, trigrams and tetragrams at the same time. Given that I have access to a cluster, I split the job in three tasks that can be computed separately on different cluster nodes. One calculates bigrams, another trigrams, and other to calculate tetragrams. So far, everything fine. The problem is that this results in three different files each with a table. I need to join tables in the same file. There are no dependencies between tables, thus you can imagine that I need something like: cat A.db B.db C.db > full.db # kidding I can do an export and import for each table. But I would like to know if there is any faster method. Thank you Kind regards, Alberto -- Alberto Simões - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Joining tables in a single file
On 12/29/06, Griggs, Donald <[EMAIL PROTECTED]> wrote: Regarding: " I need something like: cat A.db B.db C.db > full.db # kidding" - Hi Alberto, My first inclination is to consider this a classic use of the ATTACH DATABASE command http://www.sqlite.org/lang_attach.html SQLITE3 A.db >ATTACH 'B.db' as B; >ATTACH 'C.db' as C; >Create tableFromB as select * from B.tablename; >Create tableFromC as select * from C.tablename; Hmms, I think this will do the trick. Thank you :) Alberto -- Alberto Simões - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] Joining tables in a single file
Regarding: " I need something like: cat A.db B.db C.db > full.db # kidding" - Hi Alberto, My first inclination is to consider this a classic use of the ATTACH DATABASE command http://www.sqlite.org/lang_attach.html SQLITE3 A.db >ATTACH 'B.db' as B; >ATTACH 'C.db' as C; >Create tableFromB as select * from B.tablename; >Create tableFromC as select * from C.tablename; Create indices as needed. - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Joining tables in a single file
Hi I am using SQLite to store ngrams from texts (bigrams, trigrams and tetragrams). This is not really important for the question; just imagine I have three tables A (int,int), B (int, int, int) and C (int, int, int, int). As the table keys are full rows and the tables get big, it is not quite efficient com compute bigrams, trigrams and tetragrams at the same time. Given that I have access to a cluster, I split the job in three tasks that can be computed separately on different cluster nodes. One calculates bigrams, another trigrams, and other to calculate tetragrams. So far, everything fine. The problem is that this results in three different files each with a table. I need to join tables in the same file. There are no dependencies between tables, thus you can imagine that I need something like: cat A.db B.db C.db > full.db # kidding I can do an export and import for each table. But I would like to know if there is any faster method. Thank you Kind regards, Alberto -- Alberto Simões - To unsubscribe, send email to [EMAIL PROTECTED] -