sa-repository


Namesa-repository JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/Gasper3/sa-repository
SummaryRepository pattern for SQLAlchemy models
upload_time2024-08-25 10:24:19
maintainerNone
docs_urlNone
authorGasper3
requires_python<4.0,>=3.10
licenseMIT
keywords sqlalchemy repository-pattern orm repository
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SQLAlchemy Repository for models
![tests workflow](https://github.com/Gasper3/sa-repository/actions/workflows/actions.yml/badge.svg)

This project contains simple Repository pattern for SQLAlchemy models.  
All you need to do is:
1. Install this package `python -m pip install sa-repository`
2. Use it in your project
    ```python
    from sa_repository import BaseRepository
    from models import YourSAModel
    
    class SomeModelRepository(BaseRepository[YourSAModel]):
        pass
    ```

Base class contains some general methods to simplify your work with sqlalchemy models e.x
```python
var = SomeModelRepository(session).get(YourSAModel.attr == 'some_value')
```

If you don't want to create new repository classes, you can use `get_repository_from_model` method
```python
repository = BaseRepository.get_repository_from_model(db_session, SomeModel)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Gasper3/sa-repository",
    "name": "sa-repository",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "sqlalchemy, repository-pattern, orm, repository",
    "author": "Gasper3",
    "author_email": "trzecik65@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/16/15/9972f63e34d0162fc43af27a2b067e7a463bebac888c240e50057b05b45b/sa_repository-1.1.1.tar.gz",
    "platform": null,
    "description": "# SQLAlchemy Repository for models\n![tests workflow](https://github.com/Gasper3/sa-repository/actions/workflows/actions.yml/badge.svg)\n\nThis project contains simple Repository pattern for SQLAlchemy models.  \nAll you need to do is:\n1. Install this package `python -m pip install sa-repository`\n2. Use it in your project\n    ```python\n    from sa_repository import BaseRepository\n    from models import YourSAModel\n    \n    class SomeModelRepository(BaseRepository[YourSAModel]):\n        pass\n    ```\n\nBase class contains some general methods to simplify your work with sqlalchemy models e.x\n```python\nvar = SomeModelRepository(session).get(YourSAModel.attr == 'some_value')\n```\n\nIf you don't want to create new repository classes, you can use `get_repository_from_model` method\n```python\nrepository = BaseRepository.get_repository_from_model(db_session, SomeModel)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Repository pattern for SQLAlchemy models",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://github.com/Gasper3/sa-repository",
        "Repository": "https://github.com/Gasper3/sa-repository"
    },
    "split_keywords": [
        "sqlalchemy",
        " repository-pattern",
        " orm",
        " repository"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eaa76ce3000ccb7073a631667c982178ac78b96f9d4218437224fe89e8a263a7",
                "md5": "98e8ed39a862f29b129ff74d0aa9e94e",
                "sha256": "a48e5cd340e5fe07d3ca13e9baa6d981ea35875000c93ca132f8dd8bb5591f95"
            },
            "downloads": -1,
            "filename": "sa_repository-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "98e8ed39a862f29b129ff74d0aa9e94e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 4117,
            "upload_time": "2024-08-25T10:24:18",
            "upload_time_iso_8601": "2024-08-25T10:24:18.332000Z",
            "url": "https://files.pythonhosted.org/packages/ea/a7/6ce3000ccb7073a631667c982178ac78b96f9d4218437224fe89e8a263a7/sa_repository-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16159972f63e34d0162fc43af27a2b067e7a463bebac888c240e50057b05b45b",
                "md5": "ece7b789be9b401dac2ae99d4847ef99",
                "sha256": "d04921c5ca2078f5f17aa09bec85298c8f09e8450777f9f24584da3d8ccd8b1e"
            },
            "downloads": -1,
            "filename": "sa_repository-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ece7b789be9b401dac2ae99d4847ef99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 3772,
            "upload_time": "2024-08-25T10:24:19",
            "upload_time_iso_8601": "2024-08-25T10:24:19.988235Z",
            "url": "https://files.pythonhosted.org/packages/16/15/9972f63e34d0162fc43af27a2b067e7a463bebac888c240e50057b05b45b/sa_repository-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-25 10:24:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Gasper3",
    "github_project": "sa-repository",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "sa-repository"
}
        
Elapsed time: 0.32911s