April 2019
Beginner to intermediate
244 pages
6h 34m
English
Say that you wanted to front-load the genres table of your music database with every musical genre you could think of. You might choose to create a CSV file with all the data that you wanted to load, then write some code to parse the file and insert the data into the database.
At first blush, this seems pretty straightforward. You’d just need load each row of the CSV and call Repo.insert for each new record. But what if the script crashed halfway through and you wanted to run it again? Or maybe it succeeded, but you later realize that your CSV has missing or incorrect data.
To handle those scenarios, you’d have to rewrite your code. Instead of calling insert for every row in the CSV, you’d have ...
Read now
Unlock full access