Skip to main content

API Concepts

This document outlines the core entities and their relationships within DataCovey, helping users understand how data is structured and linked.

Core Entities

Tenant

  • Represents a logical organization or customer using DataCovey.
  • Each user belongs to exactly one tenant.
  • Each project is owned by a single tenant.
  • Users can only access data within their tenant.

User

  • Represents an individual user in the system.
  • Assigned a role (e.g., admin, user).
  • Always belongs to a single tenant.

Project

  • A workspace within a tenant where datasets, tables, and queries are organized.
  • Owned by a single tenant.
  • Contains multiple datasets.
  • Users from the same tenant can collaborate on a project.

Dataset

  • A collection of related tables in a project.
  • Owned by a single project.
  • Serves as a logical grouping for tables.

Table

  • Represents a data structure inside a dataset.
  • Belongs to one dataset.
  • Stores structured data.
  • Can have import and export jobs associated.

Data Processing Entities

Import Job

  • Represents the import of data into a table.
  • Linked to one specific table.
  • Tracks the status (pending, running, completed, failed).

Export Job

  • Represents the export of data from a table.
  • Linked to one specific table.
  • Tracks the status (pending, running, completed, failed).

Query

  • Represents an SQL-like query executed on data within a project.
  • Belongs to a specific project.
  • Allows users to retrieve and process shared data.

History Tracking

For auditing purposes, history tables exist for all major entities, storing archival versions of records when changes occur.

History Tables

Each of the following entities has a corresponding history table:

  • dataset_history
  • table_history
  • import_job_history
  • export_job_history
  • query_history

Purpose:

  • Tracks inserts, updates, and deletions.
  • Helps with auditing and rollback.
  • Ensures data integrity over time.

Security & Access Control

  • Every resource includes a tenant ID, ensuring strict data isolation.
  • Row-Level Security (RLS) enforces that users can only access records belonging to their tenant.
  • User roles from Auth0 determine their level of access.

Entity Relationships Summary

Tenant 1 ────> ∞ User
Tenant 1 ────> ∞ Project
Project 1 ───> ∞ Dataset
Dataset 1 ───> ∞ Table
Table 1 ───> ∞ Import Job
Table 1 ───> ∞ Export Job
Project 1 ───> ∞ Query

Entity Relationship Diagram

This diagram visually represents the relationships between core entities in DataCovey.