attrs-sqlalchemy-0.1.0
توضیحات
Add dunder-methods to SQLAlchemy models with attrs
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | attrs-sqlalchemy-0.1.0 |
| نام | attrs-sqlalchemy |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Andy Freeland |
| ایمیل نویسنده | andy@goodrx.com |
| آدرس صفحه اصلی | https://github.com/GoodRx/attrs_sqlalchemy |
| آدرس اینترنتی | https://pypi.org/project/attrs-sqlalchemy/ |
| مجوز | MIT |
================
attrs_sqlalchemy
================
.. image:: https://travis-ci.org/GoodRx/attrs_sqlalchemy.svg?branch=master
:target: https://travis-ci.org/GoodRx/attrs_sqlalchemy
:alt: CI status
Use `attrs <https://attrs.readthedocs.io>`_ to add ``__repr__``, ``__eq__``,
``__cmp__``, and ``__hash__`` methods according to the fields on a SQLAlchemy
model class.
.. code-block:: python
from attrs_sqlalchemy import attrs_sqlalchemy
@attrs_sqlalchemy
class MyModel(Base):
__tablename__ = 'mymodel'
id = sa.Column(Integer, primary_key=True)
text = sa.Column(sa.String)
instance = MyModel(id=1, text='hello')
same_data = MyModel(id=1, text='hello')
same_pk = MyModel(id=1, text='world')
assert instance == same_data
assert instance != same_pk
assert repr(instance) == "MyModel(id=1, text='hello')"
نیازمندی
| مقدار | نام |
|---|---|
| - | attrs |
| - | sqlalchemy |
نحوه نصب
نصب پکیج whl attrs-sqlalchemy-0.1.0:
pip install attrs-sqlalchemy-0.1.0.whl
نصب پکیج tar.gz attrs-sqlalchemy-0.1.0:
pip install attrs-sqlalchemy-0.1.0.tar.gz