Domanda

I'm trying to follow How do I dump the data of some SQLite3 tables? to dump a table's column in a database. The table I'm interested in is called certificates, and the column I am interested in is called certificate:

$ sqlite3 lbb.db 
SQLite version 3.8.3 2013-12-17 16:32:56
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from sqlite_master where type='table';
table|hardware|hardware|2|CREATE TABLE "hardware" (id INTEGER PRIMARY KEY, vendor TEXT, model TEXT, revision TEXT, description TEXT)
table|certificates|certificates|3|CREATE TABLE certificates(id INTEGER PRIMARY KEY, fingerprint TEXT, certificate TEXT, key TEXT, description TEXT)
table|firmware|firmware|4|CREATE TABLE firmware(id INTEGER PRIMARY KEY, device_id INTEGER, certificate_id INTEGER, vendor TEXT, description TEXT)

When I dump the table, I get the complete dump. When I try to dump the table's column, I get nearly nothing:

$ sqlite3 lbb.db ".dump 'certificates.certificate'"
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
COMMIT;
$

How do I dump the column data in a Sqlite database?

È stato utile?

Soluzione

.mode csv 
.header on 
.out file.dmp 
select certificate from certificates;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top