risclog.sqlalchemy


Namerisclog.sqlalchemy JSON
Version 7.2 PyPI version JSON
download
home_pagehttps://github.com/gocept/risclog.sqlalchemy
SummaryEncapsulate sqlalchemy modelling infrastructure.
upload_time2024-04-19 07:00:49
maintainerNone
docs_urlhttps://pythonhosted.org/risclog.sqlalchemy/
authorgocept <mail@gocept.com>
requires_python>=3.7
licenseZPL 2.1
keywords sqlalchemy alembic model infrastructure utility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==================
risclog.sqlalchemy
==================

risclog.sqlalchemy encapsulates `sqlalchemy`_ modelling infrastructure. It
eases the setup of (multi-)database environments and the usage of sqlalchemy
models by providing often used functionality on special classes.

This package is compatible with Python version 3.7 up to 3.11.

.. _`sqlalchemy`: http://www.sqlalchemy.org


=============================
Developing risclog.sqlalchemy
=============================

:Author:
    `gocept <http://gocept.com/>`_ <mail@gocept.com>

:Outdated Online documentation:
    https://pythonhosted.org/risclog.sqlalchemy/

:PyPI page:
    https://pypi.org/project/risclog.sqlalchemy/

:Issue tracker:
    https://github.com/gocept/risclog.sqlalchemy/issues/

:Source code:
    https://github.com/gocept/risclog.sqlalchemy

:Current change log:
    https://github.com/gocept/risclog.sqlalchemy/blob/master/CHANGES.rst


Running tests
=============

Simply run `./pytest` in the root of the repository.


Documentation
=============

In order to build the Sphinx documentation, run the following command with a
python, where ``sphinx`` is installed::

    $ python setup.py build_sphinx


In order to upload the Sphinx documentation, run the following command with a
python, where ``sphinx-pypi-upload`` is installed::

    $ python setup.py upload_sphinx


=================================
Change log for risclog.sqlalchemy
=================================

7.2 (2024-04-19)
================

- Add json encoder for `datetime.time` objects.


7.1 (2024-03-22)
================

- Fix `sqlalchemy` 1.3 compatibility in `Database.empty()`.


7.0 (2024-03-21)
================

- Introduce new `RoutingSession` method `execute_with_bind()` to execute
  statements with a specific bind.
- `RoutingSession.using_bind()` is now deprecated and kept for backward
  compatibility.
  Instead of a new session instance, it now returns a shim that maps a
  minimal subset of session methods to the original session instance.
  This change was necessary because the previous implementation of creating
  a new session instance and copying all the original session's state
  proved unstable when used with SQLAlchemy 1.4. (One reason being the new
  autobegin feature of sessions changing interactions with `zope.sqlalchemy`.)


6.1 (2024-03-12)
================

- Add json encoder for `uuid.UUID` objects.

- Add `risclog.sqlalchemy.interfaces.Deleted` event which is fired when an
  object is deleted from the database.


6.0 (2023-09-26)
================

- Introduce `ModelCache` that reduces the number of DB requests when dealing
  with huge amounts of sqlalchemy models.

- Allow specifying `keep_session` and `expire_on_commit`.

- Drop support for Python 3.6.

- Drop support for SQLAlchemy 1.0 and 1.1.

- Add support for Python 3.10 and 3.11.

- Restrict supported SQLALchemy to < 2.


5.1 (2021-04-28)
================

Features
--------

- Ensure compatibility with ``SQLAlchemy >= 1.4``.

Other changes
-------------

- Use github actions as CI.


5.0 (2020-11-03)
================

Backward incompatible changes
-----------------------------

- Drop support for Python 2.

- Drop the ``python2`` extra in ``setup.py``.

Features
--------

- No longer constraint to ``zope.component < 4.4.1`` (introduced in 3.0).


4.0 (2020-02-17)
================

Backward incompatible changes
-----------------------------

- Add support for ``zope.sqlalchemy >= 1.3`` by requiring at least this version.
  (Older versions only supported ``zope.sqlalchemy <= 1.2``.)

- Drop support for PyPy, PyPy3, Python 3.4 and 3.5.

Other changes
-------------

- Add support for Python 3.7, 3.8, 3.9a3.

- Migrate to Github.


3.0 (2018-01-16)
================

- Drop support for Python 3.3.

- Reintroduce `RoutingSession.using_bind` as it is needed for executing queries
  in multi database environments. It was removed in version `2.0`.

- Pin to ``zope.component < 4.4.1`` for now as we are using a private variable
  from this package which has been removed lately.


2.3 (2017-04-06)
================

- Add the fixture ``.fixtures.database__selenium_testing`` to switch SQLAlchemy
  session handling to into the same way the live server does it. Using this
  fixture leads to `DetachedInstanceError` exceptions when using a database
  object after the commit. It has to be fetched again from the database.

- Omit files from sdist which are related to buildout, testing or mercurial.

2.2 (2017-01-12)
================

- Support Python 3.6 and PyPy3.

- Fix `setup.py` to no longer use absolute paths.


2.1 (2016-01-25)
================

- Add compatibility to `pypy`.

  Also removed explicit dependency to `psycopg2` as it's a PostgreSQL specific
  dependency and not compatible with pypy. You will need `psycopg2cffi` in
  order to run `risclog.sqlalchemy` with `pypy`.


2.0 (2015-12-18)
================

- Removed ``RoutingSession.using_bind``, require SQLAlchemy >= 1.0. (#13968)

- Updated API calls to alembic, require alembic >= 0.7. (#13968)

- Added documentation. (#13952)


1.8 (2015-09-29)
================

- Officially supporting Python 3.3 up to 3.5.

- Set maximum supported version numbers of ``alembic`` and ``SQLALchemy``
  in `setup.py`


1.7.1 (2014-10-15)
==================

- Fix bug in testing mode detection so it works with sqlite, too.


1.7 (2014-07-29)
================

- Have ``.model.Object.create`` use the ``**kw`` constructor instead of
  performing setattr itself.

- Made commit in db.empty optional.


1.6 (2014-06-23)
================

- Make test setup/teardown a bit more independent from the IDatabase utility.
- Made pyramid dependent code optional, because it is an optional requirement.


1.5.1 (2014-03-31)
==================

- Moved the project to bitbucket.org and prepared for public release.


1.5 (2014-03-06)
================

- Adjust test dependency for external projects, so pyramid is not required.
  (#1458)


1.4 (2014-01-27)
================

- Do not truncate `spatial_ref_sys` when emptying entire database. (#13144)


1.3 (2013-12-18)
================

- Do not truncate `alembic_versions` when emptying entire database (using
  `db.empty(engine)`)

- Fix create_defaults, so it can be used with multiple engines. (#1172)


1.2 (2013-12-13)
================

- Fixed setup.py


1.1 (2013-12-13)
================

- Allow ``.db.Database.empty()`` to not restart sequences. (This can be
  necassary if the user is not allowed to call `ALTER SEQUENCE`.)

- Create factory for JSON renderer, so it can be customized via arguments.
  (#1037)


1.0 (2013-12-11)
================

- CAUTION: Backward incompatible changes to provide multiple database
  support. You need to change:

  * Use the ``pyramid`` extra to use the pyramid serializers and call
    ``.serializer.patch()`` by yourself.

  * Changes in `.model`:

    + Use `.model.declarative_base(cls)` to register a class as SQLALchemy
      ``declarative_base``.

    + Use your own declarative_base as `.model.Object` has been dropped.

    + Create your own `ReflectedObject` as `.model.ReflectedObject` has been
      dropped.

  * Changes in `.db.Database`:

    + To get an instance use `.db.get_database(testing=<True|False>)`.

    + To register a database with the utility use ``register_engine``.

    + ``empty`` now expects to get the engine as first argument and allows to
      cadcade via (``cascade=True``).


    + ``_verify`` was removed, use ``_verify_engine`` now.

    + ``setup_utility`` was removed, it is now done in ``__init__``.

    + To access former ``engine``` attribute use ``get_engine``.

    + ``close`` was renamed to ``drop_engine``.

    + To create all tables for a database use ``create_all``.

  * Changes in `.testing`:

    + ``setUpDB`` lost its first argument as it was not used.

    + ``setUp`` now expects a dict or ``None``, see its docstring.

- Provide a way to insert default values for new created models. (#1137)

- Added support for schema migrations with alembic.

- Dropped support for `Python 2.6`.

- Added convenience functions to create `py.test` database fixtures.

- Declared `pyramid` as test dependency so tests only need the ``test``
  extra.

- Declared testing dependency on `plone.testing[test]` since we use
  `plone.testing.zca` which imports that ``test`` extra's dependencies.


0.6 (2013-06-27)
================

- Added convenience methods on `.db.Database` for teardown in tests.

- Updated to Buildout 2.

- Using py.test as testrunner.

- Added Python 3.3 compatibility.


0.5 (2013-06-14)
================

- Add Database methods for setting up a database utility and emptying tables.

- Add testing layer that sets up a database utility (requires plone.testing).


0.4 (2013-06-07)
================

- Add helper to provide transparent json encoding of sqlalchemy mapped objects,
  dates, datetimes and decimals. (#39)

- Add `create_defaults` class method on base model which can be used to create
  test data into the database.


0.3 (2013-06-04)
================

- Repair db setup for reflected and unreflected objects.


0.2 (2013-06-04)
================

- Add unreflected Object model next to the reflected Object model.


0.1 (2013-06-03)
================

initial release

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gocept/risclog.sqlalchemy",
    "name": "risclog.sqlalchemy",
    "maintainer": null,
    "docs_url": "https://pythonhosted.org/risclog.sqlalchemy/",
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "sqlalchemy alembic model infrastructure utility",
    "author": "gocept <mail@gocept.com>",
    "author_email": "mail@gocept.com",
    "download_url": "https://files.pythonhosted.org/packages/58/74/5785e6b90a1cadb312a263c2cb9ac72e69a9d393b08056232477d6a796e0/risclog.sqlalchemy-7.2.tar.gz",
    "platform": null,
    "description": "==================\nrisclog.sqlalchemy\n==================\n\nrisclog.sqlalchemy encapsulates `sqlalchemy`_ modelling infrastructure. It\neases the setup of (multi-)database environments and the usage of sqlalchemy\nmodels by providing often used functionality on special classes.\n\nThis package is compatible with Python version 3.7 up to 3.11.\n\n.. _`sqlalchemy`: http://www.sqlalchemy.org\n\n\n=============================\nDeveloping risclog.sqlalchemy\n=============================\n\n:Author:\n    `gocept <http://gocept.com/>`_ <mail@gocept.com>\n\n:Outdated Online documentation:\n    https://pythonhosted.org/risclog.sqlalchemy/\n\n:PyPI page:\n    https://pypi.org/project/risclog.sqlalchemy/\n\n:Issue tracker:\n    https://github.com/gocept/risclog.sqlalchemy/issues/\n\n:Source code:\n    https://github.com/gocept/risclog.sqlalchemy\n\n:Current change log:\n    https://github.com/gocept/risclog.sqlalchemy/blob/master/CHANGES.rst\n\n\nRunning tests\n=============\n\nSimply run `./pytest` in the root of the repository.\n\n\nDocumentation\n=============\n\nIn order to build the Sphinx documentation, run the following command with a\npython, where ``sphinx`` is installed::\n\n    $ python setup.py build_sphinx\n\n\nIn order to upload the Sphinx documentation, run the following command with a\npython, where ``sphinx-pypi-upload`` is installed::\n\n    $ python setup.py upload_sphinx\n\n\n=================================\nChange log for risclog.sqlalchemy\n=================================\n\n7.2 (2024-04-19)\n================\n\n- Add json encoder for `datetime.time` objects.\n\n\n7.1 (2024-03-22)\n================\n\n- Fix `sqlalchemy` 1.3 compatibility in `Database.empty()`.\n\n\n7.0 (2024-03-21)\n================\n\n- Introduce new `RoutingSession` method `execute_with_bind()` to execute\n  statements with a specific bind.\n- `RoutingSession.using_bind()` is now deprecated and kept for backward\n  compatibility.\n  Instead of a new session instance, it now returns a shim that maps a\n  minimal subset of session methods to the original session instance.\n  This change was necessary because the previous implementation of creating\n  a new session instance and copying all the original session's state\n  proved unstable when used with SQLAlchemy 1.4. (One reason being the new\n  autobegin feature of sessions changing interactions with `zope.sqlalchemy`.)\n\n\n6.1 (2024-03-12)\n================\n\n- Add json encoder for `uuid.UUID` objects.\n\n- Add `risclog.sqlalchemy.interfaces.Deleted` event which is fired when an\n  object is deleted from the database.\n\n\n6.0 (2023-09-26)\n================\n\n- Introduce `ModelCache` that reduces the number of DB requests when dealing\n  with huge amounts of sqlalchemy models.\n\n- Allow specifying `keep_session` and `expire_on_commit`.\n\n- Drop support for Python 3.6.\n\n- Drop support for SQLAlchemy 1.0 and 1.1.\n\n- Add support for Python 3.10 and 3.11.\n\n- Restrict supported SQLALchemy to < 2.\n\n\n5.1 (2021-04-28)\n================\n\nFeatures\n--------\n\n- Ensure compatibility with ``SQLAlchemy >= 1.4``.\n\nOther changes\n-------------\n\n- Use github actions as CI.\n\n\n5.0 (2020-11-03)\n================\n\nBackward incompatible changes\n-----------------------------\n\n- Drop support for Python 2.\n\n- Drop the ``python2`` extra in ``setup.py``.\n\nFeatures\n--------\n\n- No longer constraint to ``zope.component < 4.4.1`` (introduced in 3.0).\n\n\n4.0 (2020-02-17)\n================\n\nBackward incompatible changes\n-----------------------------\n\n- Add support for ``zope.sqlalchemy >= 1.3`` by requiring at least this version.\n  (Older versions only supported ``zope.sqlalchemy <= 1.2``.)\n\n- Drop support for PyPy, PyPy3, Python 3.4 and 3.5.\n\nOther changes\n-------------\n\n- Add support for Python 3.7, 3.8, 3.9a3.\n\n- Migrate to Github.\n\n\n3.0 (2018-01-16)\n================\n\n- Drop support for Python 3.3.\n\n- Reintroduce `RoutingSession.using_bind` as it is needed for executing queries\n  in multi database environments. It was removed in version `2.0`.\n\n- Pin to ``zope.component < 4.4.1`` for now as we are using a private variable\n  from this package which has been removed lately.\n\n\n2.3 (2017-04-06)\n================\n\n- Add the fixture ``.fixtures.database__selenium_testing`` to switch SQLAlchemy\n  session handling to into the same way the live server does it. Using this\n  fixture leads to `DetachedInstanceError` exceptions when using a database\n  object after the commit. It has to be fetched again from the database.\n\n- Omit files from sdist which are related to buildout, testing or mercurial.\n\n2.2 (2017-01-12)\n================\n\n- Support Python 3.6 and PyPy3.\n\n- Fix `setup.py` to no longer use absolute paths.\n\n\n2.1 (2016-01-25)\n================\n\n- Add compatibility to `pypy`.\n\n  Also removed explicit dependency to `psycopg2` as it's a PostgreSQL specific\n  dependency and not compatible with pypy. You will need `psycopg2cffi` in\n  order to run `risclog.sqlalchemy` with `pypy`.\n\n\n2.0 (2015-12-18)\n================\n\n- Removed ``RoutingSession.using_bind``, require SQLAlchemy >= 1.0. (#13968)\n\n- Updated API calls to alembic, require alembic >= 0.7. (#13968)\n\n- Added documentation. (#13952)\n\n\n1.8 (2015-09-29)\n================\n\n- Officially supporting Python 3.3 up to 3.5.\n\n- Set maximum supported version numbers of ``alembic`` and ``SQLALchemy``\n  in `setup.py`\n\n\n1.7.1 (2014-10-15)\n==================\n\n- Fix bug in testing mode detection so it works with sqlite, too.\n\n\n1.7 (2014-07-29)\n================\n\n- Have ``.model.Object.create`` use the ``**kw`` constructor instead of\n  performing setattr itself.\n\n- Made commit in db.empty optional.\n\n\n1.6 (2014-06-23)\n================\n\n- Make test setup/teardown a bit more independent from the IDatabase utility.\n- Made pyramid dependent code optional, because it is an optional requirement.\n\n\n1.5.1 (2014-03-31)\n==================\n\n- Moved the project to bitbucket.org and prepared for public release.\n\n\n1.5 (2014-03-06)\n================\n\n- Adjust test dependency for external projects, so pyramid is not required.\n  (#1458)\n\n\n1.4 (2014-01-27)\n================\n\n- Do not truncate `spatial_ref_sys` when emptying entire database. (#13144)\n\n\n1.3 (2013-12-18)\n================\n\n- Do not truncate `alembic_versions` when emptying entire database (using\n  `db.empty(engine)`)\n\n- Fix create_defaults, so it can be used with multiple engines. (#1172)\n\n\n1.2 (2013-12-13)\n================\n\n- Fixed setup.py\n\n\n1.1 (2013-12-13)\n================\n\n- Allow ``.db.Database.empty()`` to not restart sequences. (This can be\n  necassary if the user is not allowed to call `ALTER SEQUENCE`.)\n\n- Create factory for JSON renderer, so it can be customized via arguments.\n  (#1037)\n\n\n1.0 (2013-12-11)\n================\n\n- CAUTION: Backward incompatible changes to provide multiple database\n  support. You need to change:\n\n  * Use the ``pyramid`` extra to use the pyramid serializers and call\n    ``.serializer.patch()`` by yourself.\n\n  * Changes in `.model`:\n\n    + Use `.model.declarative_base(cls)` to register a class as SQLALchemy\n      ``declarative_base``.\n\n    + Use your own declarative_base as `.model.Object` has been dropped.\n\n    + Create your own `ReflectedObject` as `.model.ReflectedObject` has been\n      dropped.\n\n  * Changes in `.db.Database`:\n\n    + To get an instance use `.db.get_database(testing=<True|False>)`.\n\n    + To register a database with the utility use ``register_engine``.\n\n    + ``empty`` now expects to get the engine as first argument and allows to\n      cadcade via (``cascade=True``).\n\n\n    + ``_verify`` was removed, use ``_verify_engine`` now.\n\n    + ``setup_utility`` was removed, it is now done in ``__init__``.\n\n    + To access former ``engine``` attribute use ``get_engine``.\n\n    + ``close`` was renamed to ``drop_engine``.\n\n    + To create all tables for a database use ``create_all``.\n\n  * Changes in `.testing`:\n\n    + ``setUpDB`` lost its first argument as it was not used.\n\n    + ``setUp`` now expects a dict or ``None``, see its docstring.\n\n- Provide a way to insert default values for new created models. (#1137)\n\n- Added support for schema migrations with alembic.\n\n- Dropped support for `Python 2.6`.\n\n- Added convenience functions to create `py.test` database fixtures.\n\n- Declared `pyramid` as test dependency so tests only need the ``test``\n  extra.\n\n- Declared testing dependency on `plone.testing[test]` since we use\n  `plone.testing.zca` which imports that ``test`` extra's dependencies.\n\n\n0.6 (2013-06-27)\n================\n\n- Added convenience methods on `.db.Database` for teardown in tests.\n\n- Updated to Buildout 2.\n\n- Using py.test as testrunner.\n\n- Added Python 3.3 compatibility.\n\n\n0.5 (2013-06-14)\n================\n\n- Add Database methods for setting up a database utility and emptying tables.\n\n- Add testing layer that sets up a database utility (requires plone.testing).\n\n\n0.4 (2013-06-07)\n================\n\n- Add helper to provide transparent json encoding of sqlalchemy mapped objects,\n  dates, datetimes and decimals. (#39)\n\n- Add `create_defaults` class method on base model which can be used to create\n  test data into the database.\n\n\n0.3 (2013-06-04)\n================\n\n- Repair db setup for reflected and unreflected objects.\n\n\n0.2 (2013-06-04)\n================\n\n- Add unreflected Object model next to the reflected Object model.\n\n\n0.1 (2013-06-03)\n================\n\ninitial release\n",
    "bugtrack_url": null,
    "license": "ZPL 2.1",
    "summary": "Encapsulate sqlalchemy modelling infrastructure.",
    "version": "7.2",
    "project_urls": {
        "Homepage": "https://github.com/gocept/risclog.sqlalchemy"
    },
    "split_keywords": [
        "sqlalchemy",
        "alembic",
        "model",
        "infrastructure",
        "utility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a547c315bbcd88dc2c627431c493bcbc80919b54c9f0a962ba68c20985008109",
                "md5": "60f5d985ca9dc1cb921711df66fa335a",
                "sha256": "12e43d2aba4988688b48890403b0879aedb5a8dd1cef9b986a29dd2facfcb26b"
            },
            "downloads": -1,
            "filename": "risclog.sqlalchemy-7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "60f5d985ca9dc1cb921711df66fa335a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 35366,
            "upload_time": "2024-04-19T07:00:48",
            "upload_time_iso_8601": "2024-04-19T07:00:48.080717Z",
            "url": "https://files.pythonhosted.org/packages/a5/47/c315bbcd88dc2c627431c493bcbc80919b54c9f0a962ba68c20985008109/risclog.sqlalchemy-7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58745785e6b90a1cadb312a263c2cb9ac72e69a9d393b08056232477d6a796e0",
                "md5": "3989c6f62f10994c0d8f1db26c598ced",
                "sha256": "ec6c4d74632bae88879dacedafb054dfcc3a8351a8eda409f5ce682f56b424a1"
            },
            "downloads": -1,
            "filename": "risclog.sqlalchemy-7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3989c6f62f10994c0d8f1db26c598ced",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 32589,
            "upload_time": "2024-04-19T07:00:49",
            "upload_time_iso_8601": "2024-04-19T07:00:49.592747Z",
            "url": "https://files.pythonhosted.org/packages/58/74/5785e6b90a1cadb312a263c2cb9ac72e69a9d393b08056232477d6a796e0/risclog.sqlalchemy-7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 07:00:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gocept",
    "github_project": "risclog.sqlalchemy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "risclog.sqlalchemy"
}
        
Elapsed time: 0.21846s