Skip to main content

💾 Data loader for Humans

Project description

Sargilo

Data loader for Humans

Sargilo lets you declare your data in a visually pleasing and non-frustrating way and loads it into your environment of choice. YAML usage, validation and auto-completion help you get boring jobs done.

💡 Motivation

The idea for this project came from the testing I had to do at work. Surely, you will need sample data to test the project you currently work on. After some time, two ways how to approach this have been emerged:

  • Create a minimal and abstract data sample for each test or group of tests and test against those
  • Find a more comphrehensive data set that satisfies most of edge cases and only add to it in rare cases

There are of course advantages and disadvantages to both approaches. However, I prefer the second approach and think of it as telling a little story. I prefer this way since the dataset can be used as a fixture when running your application and after working on it for quite some time, you will get a feeling for the result a function should produce, making it easier to spot errors.

📦 Install

pip install sargilo

Or if you prefer an alternative installation method

poetry add sargilo
pipenv install sargilo

🔗 Integrations

To know how to load your data, sargilo has to know how to deal with your framework or ORM of choice. While sargilo provides the interface and basic functionaly, the specifics on how to load the data are up to the integration. Currently, the following integrations are supported:

  • Django (ORM)

📒 Examples

# models.py
from django import models
from django.contrib.auth.models import User


class Tag(models.Model):
    name = models.CharField(max_length=255, blank=False, null=False)

class Post(models.Model):
    title = models.CharField(max_length=255)
    content = models.TextField()

    tag = models.ForeignKey(
        Tag,
        verbose_name='Tag',
        related_name='posts',
        on_delete=models.PROTECT
    )

    author = models.ForeignKey(
        User,
        verbose_name='Author',
        related_name='posts',
        on_delete=models.PROTECT
    )
# dataset.yaml
auth:
  users:
    - &Admin
      username:     "Admin"
      first_name:   "Christoph"
      last_name:    "Smaul"
      email:        "christoph@mail.de"
      password:     "very_secret"
      is_staff:      True
      is_superuser:  True
    - &Editor
      username:     "Editor"
      first_name:   "Wendy"
      last_name:    "Lator"
      email:        "wendy@mail.de"
      password:     "very_secret"
      is_staff:      True
      is_superuser:  False


blog:
  tags:
    - &TestTag
      name: "Test"
    - &BlueTag
      name: "Blue"
  posts:
    - title: "Hello world"
      text: "Lorem ipsum dolor amet sunt"
      tag: *TestTag
      author: *Admin

    - title: "Just a test"
      text: "This is just a test. This is just a test. This is just a test."
      tag: *TestTag
      author: *Editor

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sargilo-0.1.5.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

sargilo-0.1.5-py2.py3-none-any.whl (43.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sargilo-0.1.5.tar.gz.

File metadata

  • Download URL: sargilo-0.1.5.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/2.7.15 Linux/5.3.12-1-MANJARO

File hashes

Hashes for sargilo-0.1.5.tar.gz
Algorithm Hash digest
SHA256 594a0399190566d28fc413f961fc17416fd4dbe5142cfed140d68eef467632cf
MD5 1059f0bfb1ab1aa925b1be4cbad9a4cc
BLAKE2b-256 ee90a711c7edda96a2de46efbfbbb05fbbdd402ea63ef1bde97ef8419de5e8eb

See more details on using hashes here.

File details

Details for the file sargilo-0.1.5-py2.py3-none-any.whl.

File metadata

  • Download URL: sargilo-0.1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 43.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/2.7.15 Linux/5.3.12-1-MANJARO

File hashes

Hashes for sargilo-0.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dfe7d88fc5c26eca9893b5633ac332daebadb5dfec07c6d4927b56d27d14768b
MD5 bb3cac601173d22e0403852cc9c7ab12
BLAKE2b-256 8b2def0ea18962b6ac69c87367ab77ab84afa20c4e443843cbd10deed839f91d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page