Search notes:

SQLit. shell: .import

.import <file> <table>

Example

Create CSV file:
$ echo 'id,txt,val
1,one,first number
42,forty-two,famous number
10000,ten thousand,big number' > /tmp/data.csv

sqlite3 imported.db '.import /tmp/data.csv data'
Create «loader» script:
$ echo '
.mode csv
.import /tmp/data.csv data' > /tmp/load.sql
Import CSV:
$ sqlite3 imported.db '.read /tmp/load.sql'
Table is created with text columns:
$ sqlite3 imported.db '.schema data'

CREATE TABLE data(
  "id" TEXT,
  "txt" TEXT,
  "val" TEXT
);
In order to make sure that the datatypes are correct, it is suggested to create the table before it is loaded.

See also

SQLite: Export and import

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:51 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(51): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(66): id_of(Object(PDO), 'uri', '/notes/developm...') #2 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1788455839, '216.73.217.21', 'Mozilla/5.0 App...', NULL) #3 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQLite/shell/dot-commands/import(69): insert_webrequest() #4 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 51