"Northwind Elixir Traders" updated: tables with phone numbers

“Northwind Elixir Traders” updated: tables with phone numbers

28 May, 2024 2 min read
software, programming, Elixir, learning, Ecto, databases, book

The first part of Chapter 11 of the “Northwind Elixir Traders” book is now available.

Chapter on modeling tables with phone numbers

It’s only “the first part”, because this chapter truly kicked my butt, causing a couple of partial rewrites.

It started off uneventfully, with the main goal of modeling the remaining three tables (OrderDetails is temporarily left aside). Yet, it rapidly escalated to dealing with the phone numbers of the Suppliers and Customers tables of the original Northwind Traders database, with GETting and parsing a CSV file containing ISO 3166-1 information including dial codes (for eventually formatting and validating phone numbers as internationally-formatted, dial-code-prefixed strings).

BTW, did you know that the Dominican Republic is the only country with three different dial codes? That one was a fun one to discover, as was dealing with columns in a CSV file that contain a comma-separated list of values that break simplistic String.split/2 calls when parsing a CSV row.

Other things that this chapter includes:

  • A discussion on structuring our work (such as the modeling of tables) by using SIPOC.
  • When to batch-process enumerables vs. when to implement pipelines to work on a single item within the enumerable.
  • Making a GET request using Erlang’s :httpc client.
  • Building basic queries with customizable fields.

Part 2 of this chapter is coming soon.