sqlite-shell

How to import load a .sql or .csv file into SQLite?

别来无恙 提交于 2019-12-17 02:57:38
问题 I need to dump a .sql or .csv file into SQLite (I'm using SQLite3 API). I've only found documentation for importing/loading tables, not entire databases. Right now, when I type: sqlite3prompt> .import FILENAME TABLE I get a syntax error, since it's expecting a table and not an entire DB. 回答1: To import from an SQL file use the following: sqlite> .read <filename> To import from a CSV file you will need to specify the file type and destination table: sqlite> .mode csv <table> sqlite> .import

How to import load a .sql or .csv file into SQLite?

孤街浪徒 提交于 2019-12-17 02:57:08
问题 I need to dump a .sql or .csv file into SQLite (I'm using SQLite3 API). I've only found documentation for importing/loading tables, not entire databases. Right now, when I type: sqlite3prompt> .import FILENAME TABLE I get a syntax error, since it's expecting a table and not an entire DB. 回答1: To import from an SQL file use the following: sqlite> .read <filename> To import from a CSV file you will need to specify the file type and destination table: sqlite> .mode csv <table> sqlite> .import

How to import load a .sql or .csv file into SQLite?

我怕爱的太早我们不能终老 提交于 2019-11-26 14:55:26
I need to dump a .sql or .csv file into SQLite (I'm using SQLite3 API). I've only found documentation for importing/loading tables, not entire databases. Right now, when I type: sqlite3prompt> .import FILENAME TABLE I get a syntax error, since it's expecting a table and not an entire DB. To import from an SQL file use the following: sqlite> .read <filename> To import from a CSV file you will need to specify the file type and destination table: sqlite> .mode csv <table> sqlite> .import <filename> <table> Try doing it from the command like: cat dump.sql | sqlite3 database.db This will obviously