Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
♻️ Improve documentation of Record and Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf committed Aug 5, 2024
1 parent 6392933 commit b485bad
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lnschema_core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,14 @@ def view_parents(

# this is the metaclass for Record
class Registry(ModelBase):
"""Metadata registry.
"""Metaclass for `Record`.
Every registry maps on exactly one SQL Table of the Postgres or SQLite
database underlying any LaminDB instance.
:class:`~lamindb.core.Registry` is the `metaclass` of :class:`~lamindb.core.Record`.
`Registry` is the `metaclass` of :class:`~lamindb.core.Record`.
`Registry` extends Django's `ModelBase`.
"""

def __new__(cls, name, bases, attrs, **kwargs):
Expand Down Expand Up @@ -711,12 +713,18 @@ def __get_name_with_schema__(cls) -> str:


class Record(models.Model, metaclass=Registry):
"""Record base class.
"""Base class for metadata records.
You define a LaminDB registry by inheriting from `Record`. Every `Record`
comes with a registry in form of an auto-managed SQL table in your database.
`Record` extends Django's `Model` class. Why does LaminDB call it `Record`
and not `Model`? The term `Record` can't lead to confusion with statistical,
machine learning or biological models.
Extends ``django.db.models.Model``.
For an example, see `here
<https://github.com/laminlabs/wetlab/blob/64e1ec74c1edfa3e26bc0b432add358c34db8006/wetlab/models.py#L64-L99>`__.
Why does LaminDB call it `Record` and not `Model`? The term "Record" can't lead to
confusion with statistical, machine learning or biological models.
"""

def save(self, *args, **kwargs) -> Record:
Expand Down

0 comments on commit b485bad

Please sign in to comment.