Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to format .schema output with SQLite3?

I created some sqlite tables schema using python.

When I use the sqlite3 client and issue the .schema command, I can see the output is pre-formated as in the SQL source file I used as argument for the executescript() function.

Is there any method I could use to format the outputof the .schema command?

like image 609
Stéphane Avatar asked Nov 30 '22 16:11

Stéphane


1 Answers

In the latest version ( 3.13.0 ) , you have

>sqlite3 test.dat
SQLite version 3.13.0 2016-05-18 10:57:30

sqlite> create table test ( a integer,b integer, c integer,d float,e text, f primary key);

sqlite> .schema
CREATE TABLE test ( a integer,b integer, c integer,d float,e text, f primary key);

sqlite> .schema --indent
CREATE TABLE test(
  a integer,
  b integer,
  c integer,
  d float,
  e text,
  f primary key
);
like image 70
ravenspoint Avatar answered Dec 04 '22 07:12

ravenspoint