I will introduce you several way to output sql result into a file with using psql.
Continue reading PostgreSQL: How to Export SQL Result to FileTag Archives: TSV
PHP: Read TSV and CSV
RAILS 4 : Load Seed from TSV and CSV
At the article Rails 4 : Load Seed from TSV, I wrote about how to inject tsv seed data into your db. This time, I wrote about how to inject not only tsv, also csv seed data into your db.
Continue reading RAILS 4 : Load Seed from TSV and CSVRails 4 : Load Seed from TSV
Some days ago, I was requested to enable to load seed data from excel, by my client, in rails 4 project. I told that data to be edited should be managed in database, not excel. But he really requested excel, then I and he decided load data from tsv. Excel is functional, so TSV is appropriate.
Select data area and copy and paste with mouse, Excel data can be pasted as TSV data to text editor, and vise versa.
Environment
- Ubuntu 14.04 LTS
- Rails 4.1.8
- Ruby 2.2.2
Direction
- Create feature to load TSV data as a task, and enable to execute with
rake
. - On executing
rake db:seed
, execute the task to load TSV.