sqlalchemyseed


Namesqlalchemyseed JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://github.com/jedymatt/sqlalchemyseed
SummarySQLAlchemy Seeder
upload_time2023-03-12 03:40:05
maintainer
docs_urlNone
authorJedy Matt Tabasco
requires_python>=3.7
licenseMIT
keywords sqlalchemy orm seed seeder json yaml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            # sqlalchemyseed

[![PyPI](https://img.shields.io/pypi/v/sqlalchemyseed)](https://pypi.org/project/sqlalchemyseed)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqlalchemyseed)](https://pypi.org/project/sqlalchemyseed)
[![PyPI - License](https://img.shields.io/pypi/l/sqlalchemyseed)](https://github.com/jedymatt/sqlalchemyseed/blob/main/LICENSE)
[![Python package](https://github.com/jedymatt/sqlalchemyseed/actions/workflows/python-package.yml/badge.svg)](https://github.com/jedymatt/sqlalchemyseed/actions/workflows/python-package.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/2ca97c98929b614658ea/maintainability)](https://codeclimate.com/github/jedymatt/sqlalchemyseed/maintainability)
[![codecov](https://codecov.io/gh/jedymatt/sqlalchemyseed/branch/main/graph/badge.svg?token=W03MFZ2FAG)](https://codecov.io/gh/jedymatt/sqlalchemyseed)
[![Documentation Status](https://readthedocs.org/projects/sqlalchemyseed/badge/?version=latest)](https://sqlalchemyseed.readthedocs.io/en/latest/?badge=latest)

Sqlalchemy seeder that supports nested relationships.

Supported file types

- json
- yaml
- csv

## Installation

Default installation

```shell
pip install sqlalchemyseed
```

## Quickstart

main.py

```python
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

```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](https://github.com/jedymatt/sqlalchemyseed).

### Install dev dependencies

Inside the folder, paste this in the terminal to install necessary dependencies:

```shell
pip install -r requirements.txt -r docs/requirements.txt
```

Note: make sure you have the virtual environment and enabled, or if you are using vs code and docker then you can simply re-open this as container.

### Run tests

Before running tests, make sure that the package is installed as editable:

```shell
python setup.py develop --user
```

Then run the test:

```shell
pytest tests
```

Run test with coverage

```shell
coverage run -m pytest
```

Autobuild documentation

```shell
sphinx-autobuild docs docs/_build/html
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jedymatt/sqlalchemyseed",
    "name": "sqlalchemyseed",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "sqlalchemy,orm,seed,seeder,json,yaml",
    "author": "Jedy Matt Tabasco",
    "author_email": "jedymatt@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/69/3e/3231fc11a8a189b647fde45bbcd9a8961fea72e57b5ace8325418730fa35/sqlalchemyseed-2.0.0.tar.gz",
    "platform": null,
    "description": "# sqlalchemyseed\n\n[![PyPI](https://img.shields.io/pypi/v/sqlalchemyseed)](https://pypi.org/project/sqlalchemyseed)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqlalchemyseed)](https://pypi.org/project/sqlalchemyseed)\n[![PyPI - License](https://img.shields.io/pypi/l/sqlalchemyseed)](https://github.com/jedymatt/sqlalchemyseed/blob/main/LICENSE)\n[![Python package](https://github.com/jedymatt/sqlalchemyseed/actions/workflows/python-package.yml/badge.svg)](https://github.com/jedymatt/sqlalchemyseed/actions/workflows/python-package.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/2ca97c98929b614658ea/maintainability)](https://codeclimate.com/github/jedymatt/sqlalchemyseed/maintainability)\n[![codecov](https://codecov.io/gh/jedymatt/sqlalchemyseed/branch/main/graph/badge.svg?token=W03MFZ2FAG)](https://codecov.io/gh/jedymatt/sqlalchemyseed)\n[![Documentation Status](https://readthedocs.org/projects/sqlalchemyseed/badge/?version=latest)](https://sqlalchemyseed.readthedocs.io/en/latest/?badge=latest)\n\nSqlalchemy seeder that supports nested relationships.\n\nSupported file types\n\n- json\n- yaml\n- csv\n\n## Installation\n\nDefault installation\n\n```shell\npip install sqlalchemyseed\n```\n\n## Quickstart\n\nmain.py\n\n```python\nfrom sqlalchemyseed import load_entities_from_json\nfrom sqlalchemyseed import Seeder\nfrom db import session\n\n# load entities\nentities = load_entities_from_json('data.json')\n\n# Initializing Seeder\nseeder = Seeder(session)\n\n# Seeding\nseeder.seed(entities)\n\n# Committing\nsession.commit()  # or seeder.session.commit()\n```\n\ndata.json\n\n```json\n{\n    \"model\": \"models.Person\",\n    \"data\": [\n        {\n            \"name\": \"John March\",\n            \"age\": 23\n        },\n        {\n            \"name\": \"Juan Dela Cruz\",\n            \"age\": 21\n        }\n    ]\n}\n```\n\n## Documentation\n\n<https://sqlalchemyseed.readthedocs.io/>\n\n## Found Bug?\n\nReport here in this link:\n<https://github.com/jedymatt/sqlalchemyseed/issues>\n\n## Want to contribute?\n\nFirst, Clone this [repository](https://github.com/jedymatt/sqlalchemyseed).\n\n### Install dev dependencies\n\nInside the folder, paste this in the terminal to install necessary dependencies:\n\n```shell\npip install -r requirements.txt -r docs/requirements.txt\n```\n\nNote: make sure you have the virtual environment and enabled, or if you are using vs code and docker then you can simply re-open this as container.\n\n### Run tests\n\nBefore running tests, make sure that the package is installed as editable:\n\n```shell\npython setup.py develop --user\n```\n\nThen run the test:\n\n```shell\npytest tests\n```\n\nRun test with coverage\n\n```shell\ncoverage run -m pytest\n```\n\nAutobuild documentation\n\n```shell\nsphinx-autobuild docs docs/_build/html\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SQLAlchemy Seeder",
    "version": "2.0.0",
    "split_keywords": [
        "sqlalchemy",
        "orm",
        "seed",
        "seeder",
        "json",
        "yaml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e826396a6e85cc5ab3580f4cdc5cec2779eb90b9c99c4cb74b4b479afcf42157",
                "md5": "5f8da243ef44f9805368dc7bb129f8c5",
                "sha256": "67cc2f43e02c1d187224e04eaf0be897160f8ab5138a901273b8d4cf93ef4068"
            },
            "downloads": -1,
            "filename": "sqlalchemyseed-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f8da243ef44f9805368dc7bb129f8c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12983,
            "upload_time": "2023-03-12T03:40:04",
            "upload_time_iso_8601": "2023-03-12T03:40:04.052160Z",
            "url": "https://files.pythonhosted.org/packages/e8/26/396a6e85cc5ab3580f4cdc5cec2779eb90b9c99c4cb74b4b479afcf42157/sqlalchemyseed-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "693e3231fc11a8a189b647fde45bbcd9a8961fea72e57b5ace8325418730fa35",
                "md5": "4dce69231f3a8bea340411b157b47a53",
                "sha256": "3482c878480fe1bd2903ef9de07ab0ebdf2b92676b271161e4808b97880a7222"
            },
            "downloads": -1,
            "filename": "sqlalchemyseed-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4dce69231f3a8bea340411b157b47a53",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14494,
            "upload_time": "2023-03-12T03:40:05",
            "upload_time_iso_8601": "2023-03-12T03:40:05.705309Z",
            "url": "https://files.pythonhosted.org/packages/69/3e/3231fc11a8a189b647fde45bbcd9a8961fea72e57b5ace8325418730fa35/sqlalchemyseed-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-12 03:40:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jedymatt",
    "github_project": "sqlalchemyseed",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "sqlalchemyseed"
}
        
Elapsed time: 0.07129s