RE: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Anderson, James H \(IT\)
Not an option for what I'm doing. 

-Original Message-
From: Rich Shepard [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 09, 2007 5:19 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Is there an inverse for .import?

On Fri, 9 Mar 2007, Dennis Cote wrote:

> You can get csv output from sqlite using the .mode command to specify
the
> output format and the .output command to set the output file.
>
>   .mode csv
>   .headers on
>   .output mytable.csv
>   select * from mytable;
>   .output stdout

   Or, use the SQL format for both output and input.

   At the sqlite3> prompt, type .h(elp) and see all the choices.

Rich

-- 
Richard B. Shepard, Ph.D.   |The Environmental
Permitting
Applied Ecosystem Services, Inc.|  Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517  Fax:
503-667-8863


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Anderson, James H \(IT\)
Yes, unlike .dump, that works. Thanks very much.

jim 

-Original Message-
From: Dennis Cote [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 09, 2007 5:05 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Is there an inverse for .import?

Anderson, James H (IT) wrote:
> I need to "export" a table to a file in the same format as used by
> .import, but I don't see any such cmd. Am I missing something, or does
> such a cmd just not exist?
>
> jim
>
>   
You can get csv output from sqlite using the .mode command to specify 
the output format and the .output command to set the output file.

.mode csv
.headers on
.output mytable.csv
select * from mytable;
.output stdout

HTH
Dennis Cote


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Rich Shepard

On Fri, 9 Mar 2007, Dennis Cote wrote:


You can get csv output from sqlite using the .mode command to specify the
output format and the .output command to set the output file.

  .mode csv
  .headers on
  .output mytable.csv
  select * from mytable;
  .output stdout


  Or, use the SQL format for both output and input.

  At the sqlite3> prompt, type .h(elp) and see all the choices.

Rich

--
Richard B. Shepard, Ph.D.   |The Environmental Permitting
Applied Ecosystem Services, Inc.|  Accelerator(TM)
 Voice: 503-667-4517  Fax: 503-667-8863

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Dennis Cote

Anderson, James H (IT) wrote:

I need to "export" a table to a file in the same format as used by
.import, but I don't see any such cmd. Am I missing something, or does
such a cmd just not exist?

jim

  
You can get csv output from sqlite using the .mode command to specify 
the output format and the .output command to set the output file.


   .mode csv
   .headers on
   .output mytable.csv
   select * from mytable;
   .output stdout

HTH
Dennis Cote

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Anderson, James H \(IT\)
I'm going to go with the approach indicated, below. Using .dump didn't
work in the sense that .dump does indeed dumpt *only* in "insert into"
format.

Thanks, Clark.

-Original Message-
From: Clark Christensen [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 09, 2007 12:26 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Is there an inverse for .import?

>From the SQLite shell, you can send the output to a file using

.output myfile.txt

So

.output myfile.txt
select * from mytable;
.output stdout

will get you a pipe-delimited myfile.txt.  You can change the delimiter
using the .separator command, or you can use .mode to use a predefined
format.

 -Clark

- Original Message 
From: "Anderson, James H (IT)" <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Friday, March 9, 2007 9:04:29 AM
Subject: [sqlite] Is there an inverse for .import?

I need to "export" a table to a file in the same format as used by
.import, but I don't see any such cmd. Am I missing something, or does
such a cmd just not exist?

jim





-
To unsubscribe, send email to [EMAIL PROTECTED]

-


NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Scott Hess

Sorry, didn't read long enough.  Fire up sqlite3 and type ".help".

To "export" a table, you can do:

  .output /tmp/export
  select * from TABLE;
  .output stdout

To import, you do:

  .import /tmp/export TABLE

You can adjust the separator using .separator.  The inverse of .dump
would be .read.

-scott


On 3/9/07, Scott Hess <[EMAIL PROTECTED]> wrote:

On 3/9/07, Gunnar Roth <[EMAIL PROTECTED]> wrote:
> Anderson, James H (IT) schrieb:
> > I need to "export" a table to a file in the same format as used by
> > .import, but I don't see any such cmd. Am I missing something, or does
> > such a cmd just not exist?
>
> Maybe its dumb but its called .dump ;-)

So, that's the third suggestion of .dump.  To recreate the database
from .dump, you simply execute the sql commands within - which is not
what .import does at all!

The inverse of .import would be select!  By this I mean that if you
have a table, you do something like:

   echo "SELECT * FROM TABLE;" | sqlite3 my.db > export.file

to later import that data, at the sqlite3 command-line you'll do
".import export.file TABLE"

-scott



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Scott Hess

On 3/9/07, Gunnar Roth <[EMAIL PROTECTED]> wrote:

Anderson, James H (IT) schrieb:
> I need to "export" a table to a file in the same format as used by
> .import, but I don't see any such cmd. Am I missing something, or does
> such a cmd just not exist?

Maybe its dumb but its called .dump ;-)


So, that's the third suggestion of .dump.  To recreate the database
from .dump, you simply execute the sql commands within - which is not
what .import does at all!

The inverse of .import would be select!  By this I mean that if you
have a table, you do something like:

  echo "SELECT * FROM TABLE;" | sqlite3 my.db > export.file

to later import that data, at the sqlite3 command-line you'll do
".import export.file TABLE"

-scott

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Anderson, James H \(IT\)
Thanks, I'll try that. I misunderstood the description of .dump to mean
that it dumped in SQL insert format. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of P
Kishor
Sent: Friday, March 09, 2007 12:12 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Is there an inverse for .import?

On 3/9/07, Anderson, James H (IT) <[EMAIL PROTECTED]>
wrote:
> I need to "export" a table to a file in the same format as used by
> .import, but I don't see any such cmd. Am I missing something, or does
> such a cmd just not exist?


.dump


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
-
collaborate, communicate, compete
=


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Clark Christensen
>From the SQLite shell, you can send the output to a file using

.output myfile.txt

So

.output myfile.txt
select * from mytable;
.output stdout

will get you a pipe-delimited myfile.txt.  You can change the delimiter using 
the .separator command, or you can use .mode to use a predefined format.

 -Clark

- Original Message 
From: "Anderson, James H (IT)" <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Friday, March 9, 2007 9:04:29 AM
Subject: [sqlite] Is there an inverse for .import?

I need to "export" a table to a file in the same format as used by
.import, but I don't see any such cmd. Am I missing something, or does
such a cmd just not exist?

jim




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Leonardo Mateo

On 3/9/07, Anderson, James H (IT) <[EMAIL PROTECTED]> wrote:

I need to "export" a table to a file in the same format as used by
.import, but I don't see any such cmd. Am I missing something, or does
such a cmd just not exist?

You should set the output to that file by using .output command and
then dump that table using .dump command.

Hope it helps.

Cheers.

--
Leonardo Mateo.
There's no place like ~

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread Gunnar Roth

Anderson, James H (IT) schrieb:

I need to "export" a table to a file in the same format as used by
.import, but I don't see any such cmd. Am I missing something, or does
such a cmd just not exist?
  

Maybe its dumb but its called .dump ;-)

regards,
gunnar


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is there an inverse for .import?

2007-03-09 Thread P Kishor

On 3/9/07, Anderson, James H (IT) <[EMAIL PROTECTED]> wrote:

I need to "export" a table to a file in the same format as used by
.import, but I don't see any such cmd. Am I missing something, or does
such a cmd just not exist?



.dump


--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
-
collaborate, communicate, compete
=

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Is there an inverse for .import?

2007-03-09 Thread Anderson, James H \(IT\)
I need to "export" a table to a file in the same format as used by
.import, but I don't see any such cmd. Am I missing something, or does
such a cmd just not exist?

jim