Northwind Elixir Traders
$19.90
Minimum price
$29.70
Suggested price

Northwind Elixir Traders

A practical tutorial on databases with Elixir, Ecto, and SQLite

About the Book

This is a book for the curious and the explorers.

Step back into the nostalgic realm of 90s database exploration and learning with a modern twist! Remember the "Northwind Traders" database from the early days of Microsoft Access? It's back and ready for a reimagining in the dynamic world of the Elixir programming language and its Ecto database layer.

Join me on a learning exploration as we transform the familiar "Northwind Traders" into the captivating "Northwind Elixir Traders" through database migrations, table alterations, schema definitions, CRUD operations, references, queries, changesets and the core of what you need to use Ecto productively.

This isn't your typical Ecto tutorial. Instead of pursuing the usual "happy path" reflected in the official documentation and "Getting Started" guide, we'll dive into the complexities and nuances of database implementation, offering a refreshing exploration that goes beyond the ordinary.

Our adventure begins by embracing the simplicity of SQLite3 over the conventional choice of Postgres. This deliberate trade-off in favor of simplicity against feature-completeness introduces challenges and roadblocks that will enrich your learning experience as we navigate through the intricacies of schema design, migrations, primary and foreign keys, relational structures between the different tables, and queries that return meaningful insights.

Discover the joy of experimentation as we encounter unexpected hurdles and exercize our Elixir skills in figuring out why things don't work as expected, and how to still get things done, regardless. Through these challenges, you'll gain invaluable insights into problem-solving and critical thinking with Elixir and Ecto.

Embrace the ethos of fearless exploration as we delve deeper into Ecto's capabilities, focusing on the art of reading documentation and adapting to unforeseen obstacles. With each chapter, you'll elevate your understanding of Ecto, empowering yourself to tackle real-world database projects with confidence and finesse instead of with copy-paste operations and hopes and wishes that it all works out in the end.

For a curious Elixir newcomer delving into the world of building databases for a microservice, a backend, or a Phoenix or Phoenix LiveView app, "Northwind Elixir Traders" promises an immersive learning experience that's both enriching and unforgettable.

About the Author

Isaak Tsalicoglou
Isaak Tsalicoglou

Spurred by a serendipitous discussion with a good friend on the merits of functional programming, Isaak has since 2022 focused his programming-related activities exclusively on learning and using Elixir to develop further great software for others, as well as for his own use as an "indiehacker" by combining full-stack development skills with his extensive product development, management and marketing experience.

Isaak is an ETH Zürich Mechanical Engineer with an MBA from IMD, Switzerland. His software, training and consulting work builds on three decades of experience in using computers and programming to turbocharge products, services, and operating business models. An avid fan of open-source software and self-hosting, an early adopter of Linux since 1997, and a relentless tinkerer with NetBSD and FreeBSD, Isaak has worked with Fortran (77, 90), MATLAB, GNU Octave and Mathematica for scientific simulations, C for mobile robotics, basic C++ for refactoring proprietary FEA post-processing code, and a lot of Python for engineering optimization, neural networks and ensembles, machine learning, Monte Carlo simulations, CAD automation, and FEA and CFD model generation. He has also worked with PHP for web-based software and websites, Go for simple tasks, as well as built REST APIs for machine learning predictions of engineered components and the natural-language processing of web-scraped data, and REST APIs with simple web UIs for managing internal and customer-facing processes of an industrial equipment trading business.



Table of Contents

    • Before we begin
    • About this book
    • Preface
    • Chapter 1: The application and the repo
      • Adding dependencies
      • Creating the repository (the “repo”)
      • The need for a supervision tree
      • Summary and outlook
    • Chapter 2: Creating the database schema
      • Building the Northwind Elixir Traders database
      • Preparing and using the data structure of a Category
      • Persisting data successfully
      • Deleting records
      • Basic queries
      • Auto-incrementing integer primary keys
      • Summary and outlook
    • Chapter 3: Refining the table schema
      • More options for the table
      • To create is to destroy; to alter is to preserve
      • Investigating the impact of our alterations
      • Summary and outlook
    • Chapter 4: Introducing constraints
      • Constraints with SQLite
      • Considering database portability
      • Changesets: intended changes to data
      • Changesets and validation rules
      • Turning validation errors into helpful messages
      • Summary and outlook
    • Chapter 5: Changesets in modules with schemas
      • Custom validation functions
      • More than one changeset function
      • Creating another migration
      • Conditionally persisting data in the repo
      • Summary and outlook
    • Chapter 6: Uniqueness constraints
      • Unique indices and unique constraints
      • New insights about Ecto and SQLite3
      • Ecto migration rollbacks
      • Summary and outlook
    • Chapter 7: Basic table associations
      • Fields with numbers
      • A one-to-many association using a foreign key
      • Dealing with SQLite’s limitations on foreign key constraints
      • A custom validation function for a foreign key constraint
      • Summary and outlook
    • Chapter 8: Associations with Ecto.Schema
      • Interlude: exploration vs. exploitation
      • The N+1 query problem vs. Ecto’s preload/3
      • One-to-many relationships and has_many
      • Creating the flip-side of a one-to-many relationship
      • Improving upon an existing association
      • Summary and outlook
    • Chapter 9: Casting and putting associations
      • Casting an associated field (unsuccessfully)
      • Putting an association
      • Creating a new record using cast_assoc/4
      • Casting the reverse association
      • Summary and oulook
    • Coming soon
    • About the Author

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub