Mike Slinn
Mike Slinn

Django-Oscar Entity Relationship Diagrams

Published 2021-02-13. Last modified 2021-03-28.

This article is categorized under Django-Oscar, PostgreSQL.

A complete set of standard entity relationship diagrams for django-oscar webapps has at least 161 tables. This is how I counted them:

$ psql -U postgres -h localhost -d frobshop \
  -tc "select count(*) as tables from information_schema.tables where table_type = 'BASE TABLE';"
161

I used Dbeaver to create the following entity relationship diagrams of the django-oscar schema. There were too many table to examine in one diagram, so I examined them piecemeal.

Update 2021-03-28: When I first saw the table names I could not understand the naming convention. After having spent some time looking at the source code and playing with the software, I now believe that a table name is constructed from a Django app name, concatenated with the corresponding app model's class name, like this: {appname}_{classname}. If a class field joins to another class, the naming convention becomes: {appname}_{classname}{join_table_name}

The remainder of this blog post shows most of the 161 django-oscar tables. Some tables are shown more than once in the interest of clarity.

address_country

Centered around the <code>address_country</code> table
Centered around the address_country table

auth_user

Centered around the <code>auth_user</code> table
Centered around the auth_user table

basket_basket

Centered around the <code>basket_basket</code> table
Centered around the basket_basket table

catalogue_product

Centered around the <code>catalogue_product</code> table
Centered around the catalogue_product table

offer_range

Centered around the <code>offer_range</code> table
Centered around the offer_range table

order_order

Centered around the <code>order_order</code> table
Centered around the order_order table

partner_partner

Centered around the <code>partner_partner</code> table
Centered around the partner_partner table

payment_source

Centered around the <code>payment_source</code> table
Centered around the payment_source table

shipping

Centered around the <code>shipping</code> table
Centered around the shipping table

voucher_voucher

Centered around the <code>voucher_voucher</code> table
Centered around the voucher_voucher table

wishlists_wishlist

Centered around the <code>wishlists_wishlist</code> table
Centered around the wishlists_wishlist table