samedi 20 février 2016

How to convert sql table created after join into a csv file using sqlite?

I used SQLITE to merge two files, since my python was running out of memory when joining the two files.

I used the following command

 .headers on
 .mode csv
 .output test.csv

 Select * from new_dataframe Left outer join dataframe on new_dataframe.user_id=dataframe.user_id;

 .output stdout

When I use the above code, it gives me syntax error as

near ".": syntax error:

So I removed the ".", but then it gives me the error

near "headers": syntax error: 

Then I thought I will try using ";" but it still gives me the same error as above.

I am using DB Browser for SQLite and as you can tell fairly new to SQLite. I have tried to look up documentation and I can't figure it out. I even looked up some tutorials on youtube and they all seem to be using a '.' before their commands, however none of them is using DB browser.

Does anyone know what's going on here?

Also when I simply run this command

   Select * from new_dataframe Left outer join dataframe_updated on new_dataframe.user_id=dataframe_updated.user_id

it runs fine. Creates a new table, no ";" required, possibly because its a single line code.

Aucun commentaire:

Enregistrer un commentaire