Doing fine with SQLite

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Doing fine with SQLite

Matt Young-5
I can work SQLite from by R stat package, but I am having hard time
mixing special sqlite command intermixed with SQL statements when I
send a text sequence to swqlite (even from the dos consol)


sqlite3 test.db ".mode csv   select * from selected limit 4"

Makes sqlite choke because I do not know what the inline terminator is
for a  text invocation argument, and can't find it in the docs.

That is my last minor detail, and I have indices, joins, and unions
going on the Bureau of Labor Statistic under R.  Will make SQLite
quite popular among the economists.  Getting access to reams of data
from economic we sites, directly into R dataframes via a set of common
key words familiar to economists.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Doing fine with SQLite

Black, Michael (IS)
echo .mode csv >input.sql
echo select * from selected limit 4 >>input.sql
 
sqlite3 test.db <input.sql
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: [hidden email] on behalf of Matt Young
Sent: Tue 5/4/2010 12:02 PM
To: [hidden email]
Subject: [sqlite] Doing fine with SQLite



I can work SQLite from by R stat package, but I am having hard time
mixing special sqlite command intermixed with SQL statements when I
send a text sequence to swqlite (even from the dos consol)


sqlite3 test.db ".mode csv   select * from selected limit 4"

Makes sqlite choke because I do not know what the inline terminator is
for a  text invocation argument, and can't find it in the docs.

That is my last minor detail, and I have indices, joins, and unions
going on the Bureau of Labor Statistic under R.  Will make SQLite
quite popular among the economists.  Getting access to reams of data
from economic we sites, directly into R dataframes via a set of common
key words familiar to economists.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Doing fine with SQLite

Jay Kreibich
In reply to this post by Matt Young-5
On Tue, May 04, 2010 at 10:02:06AM -0700, Matt Young scratched on the wall:

> sqlite3 test.db ".mode csv   select * from selected limit 4"
>
> Makes sqlite choke because I do not know what the inline terminator is
> for a  text invocation argument,

  You can't put dot-commands on the command line.  Try:

  $ sqlite3 -csv test.db "select * from selected limit 4"

> and can't find it in the docs.

  $ sqlite3 --help


   -j

--
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Our opponent is an alien starship packed with atomic bombs.  We have
 a protractor."   "I'll go home and see if I can scrounge up a ruler
 and a piece of string."  --from Anathem by Neal Stephenson
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Doing fine with SQLite

Pavel Ivanov-2
>  You can't put dot-commands on the command line.  Try:

I think you can with something like this (assuming your shell is bash):

echo $'.mode csv\nselect * from selected limit 4' | sqlite3 test.db


Pavel

On Tue, May 4, 2010 at 1:11 PM, Jay A. Kreibich <[hidden email]> wrote:

> On Tue, May 04, 2010 at 10:02:06AM -0700, Matt Young scratched on the wall:
>
>> sqlite3 test.db ".mode csv   select * from selected limit 4"
>>
>> Makes sqlite choke because I do not know what the inline terminator is
>> for a  text invocation argument,
>
>  You can't put dot-commands on the command line.  Try:
>
>  $ sqlite3 -csv test.db "select * from selected limit 4"
>
>> and can't find it in the docs.
>
>  $ sqlite3 --help
>
>
>   -j
>
> --
> Jay A. Kreibich < J A Y  @  K R E I B I.C H >
>
> "Our opponent is an alien starship packed with atomic bombs.  We have
>  a protractor."   "I'll go home and see if I can scrounge up a ruler
>  and a piece of string."  --from Anathem by Neal Stephenson
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Doing fine with SQLite

Gabor Grothendieck
In reply to this post by Matt Young-5
You don't need to dump the data to a csv file and then read it into R
and there is no need to use the sqlite3 console at all as R's RSQLite
package can directly read and write SQLite databases.  Also see the
sqldf package.

On Tue, May 4, 2010 at 1:02 PM, Matt Young <[hidden email]> wrote:

> I can work SQLite from by R stat package, but I am having hard time
> mixing special sqlite command intermixed with SQL statements when I
> send a text sequence to swqlite (even from the dos consol)
>
>
> sqlite3 test.db ".mode csv   select * from selected limit 4"
>
> Makes sqlite choke because I do not know what the inline terminator is
> for a  text invocation argument, and can't find it in the docs.
>
> That is my last minor detail, and I have indices, joins, and unions
> going on the Bureau of Labor Statistic under R.  Will make SQLite
> quite popular among the economists.  Getting access to reams of data
> from economic we sites, directly into R dataframes via a set of common
> key words familiar to economists.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Doing fine with SQLite

Matt Young-5
All working.  R had sufficient piping to files and allowed me to get it.

On 5/4/10, Gabor Grothendieck <[hidden email]> wrote:

> You don't need to dump the data to a csv file and then read it into R
> and there is no need to use the sqlite3 console at all as R's RSQLite
> package can directly read and write SQLite databases.  Also see the
> sqldf package.
>
> On Tue, May 4, 2010 at 1:02 PM, Matt Young <[hidden email]> wrote:
>> I can work SQLite from by R stat package, but I am having hard time
>> mixing special sqlite command intermixed with SQL statements when I
>> send a text sequence to swqlite (even from the dos consol)
>>
>>
>> sqlite3 test.db ".mode csv   select * from selected limit 4"
>>
>> Makes sqlite choke because I do not know what the inline terminator is
>> for a  text invocation argument, and can't find it in the docs.
>>
>> That is my last minor detail, and I have indices, joins, and unions
>> going on the Bureau of Labor Statistic under R.  Will make SQLite
>> quite popular among the economists.  Getting access to reams of data
>> from economic we sites, directly into R dataframes via a set of common
>> key words familiar to economists.
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users