dataclasses-sqlitedict


Namedataclasses-sqlitedict JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/MacHu-GWU/dataclasses_sqlitedict-project
SummarySqlite backed dataclasses. It is a light weight persistent storage for dataclasses.
upload_time2023-04-08 02:50:51
maintainerUnknown
docs_urlNone
authorSanhe Hu
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            
.. .. image:: https://readthedocs.org/projects/dataclasses_sqlitedict/badge/?version=latest
    :target: https://dataclasses_sqlitedict.readthedocs.io/index.html
    :alt: Documentation Status

.. image:: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/workflows/CI/badge.svg
    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/actions?query=workflow:CI

.. image:: https://codecov.io/gh/MacHu-GWU/dataclasses_sqlitedict-project/branch/main/graph/badge.svg
    :target: https://codecov.io/gh/MacHu-GWU/dataclasses_sqlitedict-project

.. image:: https://img.shields.io/pypi/v/dataclasses_sqlitedict.svg
    :target: https://pypi.python.org/pypi/dataclasses_sqlitedict

.. image:: https://img.shields.io/pypi/l/dataclasses_sqlitedict.svg
    :target: https://pypi.python.org/pypi/dataclasses_sqlitedict

.. image:: https://img.shields.io/pypi/pyversions/dataclasses_sqlitedict.svg
    :target: https://pypi.python.org/pypi/dataclasses_sqlitedict

.. image:: https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project

------


.. .. image:: https://img.shields.io/badge/Link-Document-blue.svg
    :target: https://dataclasses_sqlitedict.readthedocs.io/index.html

.. .. image:: https://img.shields.io/badge/Link-API-blue.svg
    :target: https://dataclasses_sqlitedict.readthedocs.io/py-modindex.html

.. image:: https://img.shields.io/badge/Link-Source_Code-blue.svg
    :target: https://dataclasses_sqlitedict.readthedocs.io/py-modindex.html

.. image:: https://img.shields.io/badge/Link-Install-blue.svg
    :target: `install`_

.. image:: https://img.shields.io/badge/Link-GitHub-blue.svg
    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project

.. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg
    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/issues

.. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg
    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/issues

.. image:: https://img.shields.io/badge/Link-Download-blue.svg
    :target: https://pypi.org/pypi/dataclasses_sqlitedict#files


Welcome to ``dataclasses_sqlitedict`` Documentation
==============================================================================
Sqlite backed dataclasses. It is a light weight persistent storage for dataclasses.
If you are looking for a full featured ORM, please check out SQLAlchemy.


Features
------------------------------------------------------------------------------


Single Row Data Model
------------------------------------------------------------------------------
Each instance of class is a row in the table. And all the instances of the same class share the same database table.

.. code-block:: python

    import dataclasses
    from sqlitedict import SqliteDict
    from dataclasses_sqlitedict import SingleRowDataModel

    @dataclasses.dataclass
    class User(SingleRowDataModel):
        username: str
        password: str

        db = SqliteDict("user.sqlite", autocommit=False)

        @property
        def primary_key(self) -> str:
            return self.username

    user = User(username="alice", password="pwd")
    user.write()

    user1 = User.read("alice")
    print(user1)


Single Table Data Model
------------------------------------------------------------------------------
Each instance of class is a table. Each instance of class could be different tables in the same databases, or different table in different databases.

.. code-block:: python

    import dataclasses
    from sqlitedict import SqliteDict
    from dataclasses_sqlitedict import SingleTableDataModel

    @dataclasses.dataclass
    class User(SingleTableDataModel):
        username: str
        password: str

    db = SqliteDict("user.sqlite", autocommit=False)

    user = User(db=db, username="alice", password="pwd")
    user.write()

    user1 = User.read(db)
    print(user1)


.. _install:

Install
------------------------------------------------------------------------------

``dataclasses_sqlitedict`` is released on PyPI, so all you need is:

.. code-block:: console

    $ pip install dataclasses_sqlitedict

To upgrade to latest version:

.. code-block:: console

    $ pip install --upgrade dataclasses_sqlitedict

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MacHu-GWU/dataclasses_sqlitedict-project",
    "name": "dataclasses-sqlitedict",
    "maintainer": "Unknown",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Sanhe Hu",
    "author_email": "husanhe@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/56/c0/3e9cddb11a874a2c8b3067cf8ce7ca1c8a172a36e38b9c8cd76cab6f3803/dataclasses_sqlitedict-0.1.1.tar.gz",
    "platform": "Windows",
    "description": "\n.. .. image:: https://readthedocs.org/projects/dataclasses_sqlitedict/badge/?version=latest\n    :target: https://dataclasses_sqlitedict.readthedocs.io/index.html\n    :alt: Documentation Status\n\n.. image:: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/workflows/CI/badge.svg\n    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/actions?query=workflow:CI\n\n.. image:: https://codecov.io/gh/MacHu-GWU/dataclasses_sqlitedict-project/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/MacHu-GWU/dataclasses_sqlitedict-project\n\n.. image:: https://img.shields.io/pypi/v/dataclasses_sqlitedict.svg\n    :target: https://pypi.python.org/pypi/dataclasses_sqlitedict\n\n.. image:: https://img.shields.io/pypi/l/dataclasses_sqlitedict.svg\n    :target: https://pypi.python.org/pypi/dataclasses_sqlitedict\n\n.. image:: https://img.shields.io/pypi/pyversions/dataclasses_sqlitedict.svg\n    :target: https://pypi.python.org/pypi/dataclasses_sqlitedict\n\n.. image:: https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social\n    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project\n\n------\n\n\n.. .. image:: https://img.shields.io/badge/Link-Document-blue.svg\n    :target: https://dataclasses_sqlitedict.readthedocs.io/index.html\n\n.. .. image:: https://img.shields.io/badge/Link-API-blue.svg\n    :target: https://dataclasses_sqlitedict.readthedocs.io/py-modindex.html\n\n.. image:: https://img.shields.io/badge/Link-Source_Code-blue.svg\n    :target: https://dataclasses_sqlitedict.readthedocs.io/py-modindex.html\n\n.. image:: https://img.shields.io/badge/Link-Install-blue.svg\n    :target: `install`_\n\n.. image:: https://img.shields.io/badge/Link-GitHub-blue.svg\n    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project\n\n.. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg\n    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/issues\n\n.. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg\n    :target: https://github.com/MacHu-GWU/dataclasses_sqlitedict-project/issues\n\n.. image:: https://img.shields.io/badge/Link-Download-blue.svg\n    :target: https://pypi.org/pypi/dataclasses_sqlitedict#files\n\n\nWelcome to ``dataclasses_sqlitedict`` Documentation\n==============================================================================\nSqlite backed dataclasses. It is a light weight persistent storage for dataclasses.\nIf you are looking for a full featured ORM, please check out SQLAlchemy.\n\n\nFeatures\n------------------------------------------------------------------------------\n\n\nSingle Row Data Model\n------------------------------------------------------------------------------\nEach instance of class is a row in the table. And all the instances of the same class share the same database table.\n\n.. code-block:: python\n\n    import dataclasses\n    from sqlitedict import SqliteDict\n    from dataclasses_sqlitedict import SingleRowDataModel\n\n    @dataclasses.dataclass\n    class User(SingleRowDataModel):\n        username: str\n        password: str\n\n        db = SqliteDict(\"user.sqlite\", autocommit=False)\n\n        @property\n        def primary_key(self) -> str:\n            return self.username\n\n    user = User(username=\"alice\", password=\"pwd\")\n    user.write()\n\n    user1 = User.read(\"alice\")\n    print(user1)\n\n\nSingle Table Data Model\n------------------------------------------------------------------------------\nEach instance of class is a table. Each instance of class could be different tables in the same databases, or different table in different databases.\n\n.. code-block:: python\n\n    import dataclasses\n    from sqlitedict import SqliteDict\n    from dataclasses_sqlitedict import SingleTableDataModel\n\n    @dataclasses.dataclass\n    class User(SingleTableDataModel):\n        username: str\n        password: str\n\n    db = SqliteDict(\"user.sqlite\", autocommit=False)\n\n    user = User(db=db, username=\"alice\", password=\"pwd\")\n    user.write()\n\n    user1 = User.read(db)\n    print(user1)\n\n\n.. _install:\n\nInstall\n------------------------------------------------------------------------------\n\n``dataclasses_sqlitedict`` is released on PyPI, so all you need is:\n\n.. code-block:: console\n\n    $ pip install dataclasses_sqlitedict\n\nTo upgrade to latest version:\n\n.. code-block:: console\n\n    $ pip install --upgrade dataclasses_sqlitedict\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Sqlite backed dataclasses. It is a light weight persistent storage for dataclasses.",
    "version": "0.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d2ad93e9c05bb43b496f87eaab5471a4a2d75f6a7fecec62bdd7ff6c10e369d7",
                "md5": "f657c94cee118bd707ca017857047cdf",
                "sha256": "8241e171b0ed34130593afc43e8cefad52a3be8a86bfd932f0f1f3b941547b39"
            },
            "downloads": -1,
            "filename": "dataclasses_sqlitedict-0.1.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f657c94cee118bd707ca017857047cdf",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 7289,
            "upload_time": "2023-04-08T02:50:49",
            "upload_time_iso_8601": "2023-04-08T02:50:49.311415Z",
            "url": "https://files.pythonhosted.org/packages/d2/ad/93e9c05bb43b496f87eaab5471a4a2d75f6a7fecec62bdd7ff6c10e369d7/dataclasses_sqlitedict-0.1.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "56c03e9cddb11a874a2c8b3067cf8ce7ca1c8a172a36e38b9c8cd76cab6f3803",
                "md5": "d503e7a21cfa5f9359b61f02df8fef36",
                "sha256": "a0f479b4c3508a30baa4d314d39bf1dda0f3c36763aba0917e05ee4a02a93557"
            },
            "downloads": -1,
            "filename": "dataclasses_sqlitedict-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d503e7a21cfa5f9359b61f02df8fef36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7924,
            "upload_time": "2023-04-08T02:50:51",
            "upload_time_iso_8601": "2023-04-08T02:50:51.553457Z",
            "url": "https://files.pythonhosted.org/packages/56/c0/3e9cddb11a874a2c8b3067cf8ce7ca1c8a172a36e38b9c8cd76cab6f3803/dataclasses_sqlitedict-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-08 02:50:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "MacHu-GWU",
    "github_project": "dataclasses_sqlitedict-project",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "dataclasses-sqlitedict"
}
        
Elapsed time: 0.06112s