copiousfreetime / amalgalite

SQLite database engine embedded in a ruby extension.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expand the import from csv functionality to automatically create a table from the data

copiousfreetime opened this issue · comments

Just an idea at this point. What if the importing of a csv also created the table in which to store the csv data?

Would be a really nice feature. I'm currently working on a project were I have to get remote data from Firebird.
Then I use the data with amalgalites timeout feature in my Webapp. Currently I'm exporting each table and then importing via bash into my sqlite/amalgalite-db.
A direct data transfer/replica looks very interesting. I mean, the SEQUEL_PLUS -gem does a good job for me so far:

require 'sequel'
require 'sequel_plus'

DB = Sequel.sqlite

# Every row, every column, comma delimited double-quotes
File.open("nodes.txt", "w"){|file| DB[:nodes].export(file, :delimiter => ',', :quote_char => '"')}

Seems to be fine CSV-Data, so you could and default it does not send to File, it sends to stdout. So you could take the out directly.