Hi I have data in a csv file format that Id like to import into my postgresql. The postgresql would be used in my rails app as a prepopulated db. I realize rails uses a ORM . So I was wondering if its good to import data into the db like this.
If not how should I do it?
In general, for bulk loading you’ll want to use the
COPYinterface or, if you can afford downtime and have truly monsterous amounts of data to load,pg_bulkload.COPYcan be client- or server-side. For client-sideCOPYyour client needs to support it.libpqdoes, as does thepsqlclient. PgJDBC also supportsCOPYfrom client side. I don’t know if Ruby’s database interface does, but I doubt it. If it doesn’t you can use server-sideCOPYif you have appropriate access permissions on the server, or you can shell out topsqlto do the bulk import using the psql\copycommand.