=================
sqlalchemy-things
=================
|ReadTheDocs| |PyPI release| |License| |Python versions| |PyPI downloads| |GitHub CI|
.. |ReadTheDocs| image:: https://readthedocs.org/projects/sqlalchemy-things/badge/?version=latest
:target: https://sqlalchemy-things.readthedocs.io/en/latest/?badge=latest
:alt: Read The Docs build
.. |PyPI release| image:: https://badge.fury.io/py/sqlalchemy-things.svg
:target: https://pypi.org/project/sqlalchemy-things/
:alt: Release
.. |License| image:: https://img.shields.io/badge/License-MIT-green
:target: https://github.com/ri-gilfanov/sqlalchemy-things/blob/master/LICENSE
:alt: MIT License
.. |Python versions| image:: https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue
:target: https://pypi.org/project/sqlalchemy-things/
:alt: Python version support
.. |PyPI downloads| image:: https://static.pepy.tech/personalized-badge/sqlalchemy-things?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads
:target: https://pepy.tech/project/sqlalchemy-things
:alt: PyPI downloads count
.. |GitHub CI| image:: https://github.com/ri-gilfanov/sqlalchemy-things/actions/workflows/ci.yml/badge.svg?branch=master
:target: https://github.com/ri-gilfanov/sqlalchemy-things/actions/workflows/ci.yml
:alt: GitHub continuous integration
Utility collection for development with `SQLAlchemy 2.0
<https://www.sqlalchemy.org/>`_ ORM.
Documentation
-------------
https://sqlalchemy-things.readthedocs.io
Installation
------------
Installing ``sqlalchemy-things`` with pip: ::
pip install sqlalchemy-things
Examples
--------
Single table inheritance
^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
from sqlalchemy import orm
from sqlalchemy_things.declarative import (
IntegerPrimaryKeyMixin,
PolymorphicMixin,
)
class Base(orm.DeclarativeBase): ...
class ParentA(Base, IntegerPrimaryKeyMixin, PolymorphicMixin):
__tablename__ = "single_table"
class ChildA1(ParentA):
__mapper_args__ = {"polymorphic_identity": "child_a1"}
some_field = sa.Column(sa.String(255))
class ChildA2(ParentA):
__mapper_args__ = {"polymorphic_identity": "child_a2"}
other_filed = sa.Column(sa.String(127))
Joined table inheritance with cascade primary key mixins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
from sqlalchemy import orm
from sqlalchemy_things.declarative import (
CascadeIntegerPrimaryKeyMixin,
PolymorphicMixin,
)
class Base(orm.DeclarativeBase): ...
class ParentB(Base, CascadeIntegerPrimaryKeyMixin, PolymorphicMixin):
__tablename__ = "parent_b"
class ChildB1(ParentB):
__tablename__ = "child_b1"
__mapper_args__ = {"polymorphic_identity": "child_b1"}
some_field = sa.Column(sa.String(255))
class ChildB2(ParentB):
__tablename__ = "child_b2"
__mapper_args__ = {"polymorphic_identity": "child_b2"}
some_field = sa.Column(sa.String(127))
Joined table inheritance with simple primary key mixins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
from sqlalchemy import orm
from sqlalchemy_things.declarative import (
IntegerPrimaryKeyMixin,
ParentPrimaryKeyMixin,
PolymorphicMixin,
)
class Base(orm.DeclarativeBase): ...
class ParentC(Base, IntegerPrimaryKeyMixin, PolymorphicMixin):
__tablename__ = "parent_c"
class ChildC1(ParentPrimaryKeyMixin, ParentC):
__tablename__ = "child_c1"
__mapper_args__ = {"polymorphic_identity": "child_c1"}
some_field = sa.Column(sa.String(255))
class ChildC2(ParentPrimaryKeyMixin, ParentC):
__tablename__ = "child_c2"
__mapper_args__ = {"polymorphic_identity": "child_c2"}
some_field = sa.Column(sa.String(127))
Raw data
{
"_id": null,
"home_page": "https://github.com/ri-gilfanov/sqlalchemy-things",
"name": "sqlalchemy-things",
"maintainer": "Ruslan Ilyasovich Gilfanov",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": "ri.gilfanov@yandex.ru",
"keywords": "sqlalchemy",
"author": "Ruslan Ilyasovich Gilfanov",
"author_email": "ri.gilfanov@yandex.ru",
"download_url": "https://files.pythonhosted.org/packages/3b/5a/82c8b56800b0e7ac7b0f1ae06821b18b44f3aef64f44d8fc57bbba042956/sqlalchemy_things-1.1.0.tar.gz",
"platform": null,
"description": "=================\nsqlalchemy-things\n=================\n|ReadTheDocs| |PyPI release| |License| |Python versions| |PyPI downloads| |GitHub CI|\n\n.. |ReadTheDocs| image:: https://readthedocs.org/projects/sqlalchemy-things/badge/?version=latest\n :target: https://sqlalchemy-things.readthedocs.io/en/latest/?badge=latest\n :alt: Read The Docs build\n\n.. |PyPI release| image:: https://badge.fury.io/py/sqlalchemy-things.svg\n :target: https://pypi.org/project/sqlalchemy-things/\n :alt: Release\n\n.. |License| image:: https://img.shields.io/badge/License-MIT-green\n :target: https://github.com/ri-gilfanov/sqlalchemy-things/blob/master/LICENSE\n :alt: MIT License\n\n.. |Python versions| image:: https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue\n :target: https://pypi.org/project/sqlalchemy-things/\n :alt: Python version support\n\n.. |PyPI downloads| image:: https://static.pepy.tech/personalized-badge/sqlalchemy-things?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads\n :target: https://pepy.tech/project/sqlalchemy-things\n :alt: PyPI downloads count\n\n.. |GitHub CI| image:: https://github.com/ri-gilfanov/sqlalchemy-things/actions/workflows/ci.yml/badge.svg?branch=master\n :target: https://github.com/ri-gilfanov/sqlalchemy-things/actions/workflows/ci.yml\n :alt: GitHub continuous integration\n\nUtility collection for development with `SQLAlchemy 2.0\n<https://www.sqlalchemy.org/>`_ ORM.\n\nDocumentation\n-------------\nhttps://sqlalchemy-things.readthedocs.io\n\nInstallation\n------------\nInstalling ``sqlalchemy-things`` with pip: ::\n\n pip install sqlalchemy-things\n\nExamples\n--------\nSingle table inheritance\n^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: python\n\n from sqlalchemy import orm\n from sqlalchemy_things.declarative import (\n IntegerPrimaryKeyMixin,\n PolymorphicMixin,\n )\n\n class Base(orm.DeclarativeBase): ...\n\n\n class ParentA(Base, IntegerPrimaryKeyMixin, PolymorphicMixin):\n __tablename__ = \"single_table\"\n\n\n class ChildA1(ParentA):\n __mapper_args__ = {\"polymorphic_identity\": \"child_a1\"}\n some_field = sa.Column(sa.String(255))\n\n\n class ChildA2(ParentA):\n __mapper_args__ = {\"polymorphic_identity\": \"child_a2\"}\n other_filed = sa.Column(sa.String(127))\n\nJoined table inheritance with cascade primary key mixins\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: python\n\n from sqlalchemy import orm\n from sqlalchemy_things.declarative import (\n CascadeIntegerPrimaryKeyMixin,\n PolymorphicMixin,\n )\n\n class Base(orm.DeclarativeBase): ...\n\n\n class ParentB(Base, CascadeIntegerPrimaryKeyMixin, PolymorphicMixin):\n __tablename__ = \"parent_b\"\n\n\n class ChildB1(ParentB):\n __tablename__ = \"child_b1\"\n __mapper_args__ = {\"polymorphic_identity\": \"child_b1\"}\n some_field = sa.Column(sa.String(255))\n\n\n class ChildB2(ParentB):\n __tablename__ = \"child_b2\"\n __mapper_args__ = {\"polymorphic_identity\": \"child_b2\"}\n some_field = sa.Column(sa.String(127))\n\n\nJoined table inheritance with simple primary key mixins\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: python\n\n from sqlalchemy import orm\n from sqlalchemy_things.declarative import (\n IntegerPrimaryKeyMixin,\n ParentPrimaryKeyMixin,\n PolymorphicMixin,\n )\n\n class Base(orm.DeclarativeBase): ...\n\n\n class ParentC(Base, IntegerPrimaryKeyMixin, PolymorphicMixin):\n __tablename__ = \"parent_c\"\n\n\n class ChildC1(ParentPrimaryKeyMixin, ParentC):\n __tablename__ = \"child_c1\"\n __mapper_args__ = {\"polymorphic_identity\": \"child_c1\"}\n some_field = sa.Column(sa.String(255))\n\n\n class ChildC2(ParentPrimaryKeyMixin, ParentC):\n __tablename__ = \"child_c2\"\n __mapper_args__ = {\"polymorphic_identity\": \"child_c2\"}\n some_field = sa.Column(sa.String(127))\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Utility collection for development with SQLalchemy ORM.",
"version": "1.1.0",
"project_urls": {
"Documentation": "https://sqlalchemy-things.readthedocs.io/",
"Homepage": "https://github.com/ri-gilfanov/sqlalchemy-things",
"Repository": "https://github.com/ri-gilfanov/sqlalchemy-things"
},
"split_keywords": [
"sqlalchemy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "441c15475e2bb32d83c82c2e9ce2479a2d00e8fc26be3328561e6756079eca8c",
"md5": "085da8c8b39f0c24154fc78313af942f",
"sha256": "521698cd3bd93dcedc9c5e268c830b8898a7e4b2ceddfb84ec5f8f8b893c2729"
},
"downloads": -1,
"filename": "sqlalchemy_things-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "085da8c8b39f0c24154fc78313af942f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 7762,
"upload_time": "2024-12-06T03:17:19",
"upload_time_iso_8601": "2024-12-06T03:17:19.288643Z",
"url": "https://files.pythonhosted.org/packages/44/1c/15475e2bb32d83c82c2e9ce2479a2d00e8fc26be3328561e6756079eca8c/sqlalchemy_things-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3b5a82c8b56800b0e7ac7b0f1ae06821b18b44f3aef64f44d8fc57bbba042956",
"md5": "2bdb5759b28d6328259dbab59f28ce22",
"sha256": "0b1601b4f1c1259f2a3fa425e8bf1b1f962438f597921e4b021e587348312b89"
},
"downloads": -1,
"filename": "sqlalchemy_things-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2bdb5759b28d6328259dbab59f28ce22",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 6856,
"upload_time": "2024-12-06T03:17:21",
"upload_time_iso_8601": "2024-12-06T03:17:21.168333Z",
"url": "https://files.pythonhosted.org/packages/3b/5a/82c8b56800b0e7ac7b0f1ae06821b18b44f3aef64f44d8fc57bbba042956/sqlalchemy_things-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 03:17:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ri-gilfanov",
"github_project": "sqlalchemy-things",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sqlalchemy-things"
}