Dealing with various sources of data in web applications requires us to create services that will extract information from CSV, Excel, and other file types. In that case, it’s best to use some existing libraries, or if your backend is on Rails, use gems. There are many gems with very cool features like CSVImporter and Roo. But you can also use plain Ruby CSV. Either way, if those are small CSV fil
Let’s say that we have to import data from some social network. We will be provided with CSV file generated every 5 minutes containing list of posts that were added/liked/commented since the beginning of the day together with likes’ and comments’ counts for each post. As you can imagine the file will grow in size during the day; also we are looking at not only inserting new posts but also updating
こんにちは!SQL 大好き kano-e です。 「データ更新のたびに新規にテーブルを作って、そこにデータを投入したい」とか。 「お客様を DB に登録したら、合わせてそのお客様専用のテーブルを作っておきたい」とか。 「とにかくこの CSV の内容を DB に投入したい、10万件」とか。 こんな状況、意外と遭遇していませんか? この記事では、そんな時に多分役立つ「Rails で動的にテーブルを作成して、大きな CSV のデータを PostgreSQL にインポートする方法」について、思いつくままにまとめてみました。 合わせて読みたい「動的に作成したテーブルを db/schema.rb に含めない方法」のおまけ付きです。 はじめに この記事では、以下の内容についてまとめています。 Rails で動的にテーブルを CREATE/DROP する テーブルに対応するモデルを用意せずに SQL を組
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く