Skip to main content

SQLAlchemy Seeder

Project description

sqlalchemyseed

PyPI PyPI - Python Version PyPI - License Python package Maintainability codecov Documentation Status

Sqlalchemy seeder that supports nested relationships.

Supported file types

  • json
  • yaml
  • csv

Installation

Default installation

pip install sqlalchemyseed

Quickstart

main.py

from sqlalchemyseed import load_entities_from_json
from sqlalchemyseed import Seeder
from db import session

# load entities
entities = load_entities_from_json('data.json')

# Initializing Seeder
seeder = Seeder(session)

# Seeding
seeder.seed(entities)

# Committing
session.commit()  # or seeder.session.commit()

data.json

{
    "model": "models.Person",
    "data": [
        {
            "name": "John March",
            "age": 23
        },
        {
            "name": "Juan Dela Cruz",
            "age": 21
        }
    ]
}

Documentation

https://sqlalchemyseed.readthedocs.io/

Found Bug?

Report here in this link: https://github.com/jedymatt/sqlalchemyseed/issues

Want to contribute?

First, Clone this repository.

This project uses uv for dependency management and running tasks.

Install dev dependencies

Inside the folder, sync the environment (uv creates the virtualenv and installs the project plus dev dependencies):

uv sync

Run tests

uv run pytest

Run the tests against a specific Python version (uv downloads it if needed):

uv run --python 3.14 pytest

Run the tests against the lowest supported dependencies (e.g. SQLAlchemy 2.0):

uv run --resolution lowest-direct pytest

Run tests with coverage:

uv run coverage run -m pytest

Autobuild documentation

sphinx-autobuild docs docs/_build/html

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

sqlalchemyseed-2.1.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlalchemyseed-2.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemyseed-2.1.0.tar.gz.

File metadata

  • Download URL: sqlalchemyseed-2.1.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for sqlalchemyseed-2.1.0.tar.gz
Algorithm Hash digest
SHA256 db4460a67367fd7a47d4c0c89e3436460dcea89cf6b95d597ac056b24666ac9b
MD5 1568290bd751fd602a28f74c355b8f18
BLAKE2b-256 2873da3f21614d6b0bddeae84884458469788ec0341859fc46f8dc7ba4ada42f

See more details on using hashes here.

File details

Details for the file sqlalchemyseed-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: sqlalchemyseed-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for sqlalchemyseed-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a84bccf9adf7b7111cde644f3a1a51e7a724af056462419bb8e4ad56086a7246
MD5 a37e8d5a0e551316b9ba65657722c987
BLAKE2b-256 5dac6453fc7083ecb73d8ee32c5a37704a2f419b17238c995e025fbd8a39cf32

See more details on using hashes here.

Supported by

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