Skip to content

Overview

Migrations and Databases

Django manages databases for us, read more about how we use it here Tutorials/Migrations

Django Help

Below are some quick links for more information in regards to Django's tools, and features.

Content URL Description
Models https://docs.djangoproject.com/en/3.0/topics/db/models/ For information about who Django's models work, and how best to implement
Fields https://docs.djangoproject.com/en/3.0/ref/models/fields/#model-field-types Overview of the main Django model fields
Foreign Keys https://docs.djangoproject.com/en/3.0/topics/db/models/#relationships Relationships is how Django deals with DB foreign keys

Cubed's models are separated into different categories, allowing us to group together similar data types. For example, models that handle configuring an account are under Attrib, while Aggregated data sits under Agg.

Django Models

These tables are written to by the data collection servers so cannot be locked for more than a small period of time without causing a backlog.

  • attrib_event_item
  • attrib_event_item_details
  • attrib_label
  • attrib_page
  • attrib_sync
  • attrib_sync_map
  • attrib_visit
  • attrib_visit_details
  • attrib_visitor

Structure

Client

Any models that are stored in the attrib_client DBs will have their models inside of /client/models/ and will be categories as one of the following:

models
├── agg.py
├── attrib.py
├── config.py
├── file_upload.py
├── impression.py
├── integration.py
├── models.py
├── report.py
├── segmenter.py
├── seopt.py
└── web_scraping.py
Category Description
Agg For any of the aggregated raw data tables, located in the attrib_client DBs.
Attrib Tables that contain the raw collected data from the tags.
File Upload Tables that contain data from file uploads.
Impression Tables that contain data from impressions.
Integration Tables that contain data from API integrations.
models A helper file that imports all the models from the other files.
Report Tables that contain data from reports.
Segmenter Tables that contain data from the segmenter.
Seopt Tables that contain data from the centralised seo server (SEOPT)
Web Scraping Tables that contain data from web scraping.

Base

The base app inside Django is tied to our attrib database, this is where global data is stored. This includes, activate clients, users, command runs and more.