# How do I populate the database? source foo.sql?

**URL:** <https://www.ruby-forum.com/t/how-do-i-populate-the-database-source-foo-sql/128266>\
**Category:** Rails\
**Created:** [February 6, 2008, 10:05am UTC](https://www.ruby-forum.com/t/how-do-i-populate-the-database-source-foo-sql/128266 "2008-02-06T10:05:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [February 6, 2008, 10:05am UTC](https://www.ruby-forum.com/t/how-do-i-populate-the-database-source-foo-sql/128266/1 "2008-02-06T10:05:11Z")

</div>

I’ve tried several techniques to importing data, no success.

I don’t have much SQL, do I need to do something like “load infile”  
through SQL to import data? Or, can I do something through rails with  
the “source foo.sql” command, which looks promising but I, for one,  
can’t  
figure out the syntax ☹

thufir@arrakis ~/goodfellow-tool/db $  
thufir@arrakis ~/goodfellow-tool/db $ sqlite3 development.sqlite3 \<  
data.sql  
SQL error near line 1: near “/”: syntax error  
thufir@arrakis ~/goodfellow-tool/db $  
thufir@arrakis ~/goodfellow-tool/db $ cat data.sql  
insert into db/development.sqlite3.calls (name) values (“goodfellow”);

thufir@arrakis ~/goodfellow-tool/db $  
thufir@arrakis ~/goodfellow-tool/db $ source data.sql  
bash: data.sql: line 1: syntax error near unexpected token `(' bash: data.sql: line 1:`insert into db/development.sqlite3.calls (name)  
values (“goodfellow”);’  
thufir@arrakis ~/goodfellow-tool/db $  
thufir@arrakis ~/goodfellow-tool/db $  
thufir@arrakis ~/goodfellow-tool/db $ sqlite3 development.sqlite3  
SQLite version 3.4.1  
Enter “.help” for instructions  
sqlite\> .schema  
CREATE TABLE calls (“id” INTEGER PRIMARY KEY NOT NULL, “start” integer  
DEFAULT NULL, “end” integer DEFAULT NULL, “name” varchar(255) DEFAULT  
NULL, “avaya\_login” integer DEFAULT NULL);  
CREATE TABLE schema\_info (version integer);  
sqlite\> .quit  
thufir@arrakis ~/goodfellow-tool/db $

thanks,

Thufir
