anybox.pg.odoo


Nameanybox.pg.odoo JSON
Version 0.7 PyPI version JSON
download
home_page
SummaryPostgresql database snapshot versionning tool
upload_time2024-02-13 13:23:47
maintainer
docs_urlNone
authorChristophe Combelles
requires_python
licenseGPLv3
keywords odb postgresql odoo snapshot commit version
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            anybox.pg.odoo
==============

This tool basically manages versioned snapshots of the current database,
mimicking the common workflow of VCS tools such as init, commit, revert, log, etc.
It was first created to snapshot Odoo databases but may be easily modified to be
agnostic.

.. contents::

Install
-------

This tool works on Python 2.7 and Python 3.x.
Install as any normal Python distribution, in a virtualenv, buildout or
system-wide. The only current dependency is `psycopg2
<https://pypi.python.org/pypi/psycopg2/>`_ >= 2.5.

Example with a virtualenv::

    $ virtualenv sandbox && source sandbox/bin/activate
    $ pip install anybox.pg.odoo

Usage
-----

First read the available commands with ``odb -h``.
You get the available commands::

        init                Set the current db
        commit              Save the current db in a new revision
        info                Display the revision of the current db
        revert              Drop the current db and clone from a previous revision
        log                 List all available revisions
        purge               Destroy revisions
        tags                List all tags
        tag                 Tag a specific revision


You should first set the current database with ``odb init``::

    $ odb init demo8
    Now revision 1

Then you can get the current revision with ``odb info``::

    $ odb info
    database: demo8
    revision : 1 (parent: 0)

Commit the current database to create a snapshot and a new revision with ``odb commit``::

    $ odb commit
    Now revision 2
    $ odb info
    database: demo8
    revision : 2 (parent: 1)
    $ odb commit
    Now revision 3
    $ odb commit
    Now revision 4

You can revert back to the last revision of the database (the parent) with ``odb revert``::

    $ odb revert
    Reverted to parent 3, now at revision 4

You can also revert back to any previous revision::

    $ odb revert 2
    Reverted to parent 2, now at revision 4
    $ odb info
    database: demo8
    revision : 4 (parent: 2)

You can put tags on a revision, revert to a tag and delete a tag with ``odb tag`` and ``odb tags``::

    $ odb tag v1 2
    $ odb tag v2 3
    $ odb tags
    v2 (demo8*3)
    v1 (demo8*2)
    $ odb revert v1
    Reverted to parent 2, now at revision 4
    $ odb tag -d v1

The you can display all the revisions with ``odb log``::

    $ odb log
    demo8:
        revision: 4
        parent: 2
    demo8*3:
        revision: 3
        parent: 2
        tag: v2
    demo8*2:
        revision: 2
        parent: 1
    demo8*1:
        revision: 1
        parent: 0

Then you can purge all the revisions except the tags::

    $ odb purge keeptags

or all the revisions::

    $ odb purge all




How it works and pollutes
-------------------------

- It uses the ``CREATE DATABASE FROM TEMPLATE`` feature of PostgreSQL
- It currently stores version information in the ``ir_config_parameter`` table
  of Odoo (though this will change in the future).
- It expects that the connection to PostgreSQL is done through Unix Domain
  Socket with the current user being allowed to create and drop databases.
- It stores the current database in ``~/.anybox.pg.odoo``

what's next? (todo list)
------------------------

- Use a dedicated database to store version information instead of the ``ir_config_parameter`` table
- Implement diff (#fear)
- Improve the database naming scheme

Contribute
----------

Mercurial repository and bug tracker: https://bitbucket.org/anybox/anybox.pg.odoo

Run tests with::

    $ python setup.py test

Changelog
=========

0.7 (unreleased)
----------------

- fixed setting autocommit before creating new transaction
- fixed error in Python 3
- implement graph option ``odb log --graph``
- fixed `issue #7
  <https://bitbucket.org/anybox/anybox.pg.odoo/issues/7/revert-on-used-db>`_,
  force to close exists connexion on copied database before make the copy
- Implement `issue #4 <https://bitbucket.org/anybox/anybox.pg.odoo/issues/4/
  limit-option-to-odb-log>`_ **limit** log option to limit number of changes
  displayed

0.6 (2014-11-02)
----------------

- fixed error in Python 3
- remove tag and message of the current version after commit and revert

0.5 (2014-10-19)
----------------

- Works on Python 3.1+
- Works on Postgres 9.1 and maybe lower
- ``odb purge keeptags`` : purge all but tags
- implemented commit message
- revert now checks that the source db exists (much safer)

0.4 (2014-10-19)
----------------

- Implemented ``odb log``
- Implemented ``odb purge``
- Implemented ``odb tag`` and revert to tag
- Implemented ``odb tags``
- Renamed version to revision
- Renamed snapshot() to commit()

0.3 (2014-10-16)
----------------

- Keep the same db as the current one to work in place
- Fixed versionning and start at 1
- Also disconnect during revert operation
- Removed the unneeded tip

0.2 (2014-10-15 after sleeping)
-------------------------------

- Fixed packaging
- Fixed the ``revert`` behaviour
- Allow to revert without argument
- Improved doc

0.1 (2014-10-15)
----------------

- Initial draft

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "anybox.pg.odoo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "odb postgresql odoo snapshot commit version",
    "author": "Christophe Combelles",
    "author_email": "ccomb@anybox.fr",
    "download_url": "https://files.pythonhosted.org/packages/2c/74/3efd3ac576dd55464866ede2e47b1e93ed0a54f493e4d66c1784dc88c5f8/anybox.pg.odoo-0.7.tar.gz",
    "platform": null,
    "description": "anybox.pg.odoo\n==============\n\nThis tool basically manages versioned snapshots of the current database,\nmimicking the common workflow of VCS tools such as init, commit, revert, log, etc.\nIt was first created to snapshot Odoo databases but may be easily modified to be\nagnostic.\n\n.. contents::\n\nInstall\n-------\n\nThis tool works on Python 2.7 and Python 3.x.\nInstall as any normal Python distribution, in a virtualenv, buildout or\nsystem-wide. The only current dependency is `psycopg2\n<https://pypi.python.org/pypi/psycopg2/>`_ >= 2.5.\n\nExample with a virtualenv::\n\n    $ virtualenv sandbox && source sandbox/bin/activate\n    $ pip install anybox.pg.odoo\n\nUsage\n-----\n\nFirst read the available commands with ``odb -h``.\nYou get the available commands::\n\n        init                Set the current db\n        commit              Save the current db in a new revision\n        info                Display the revision of the current db\n        revert              Drop the current db and clone from a previous revision\n        log                 List all available revisions\n        purge               Destroy revisions\n        tags                List all tags\n        tag                 Tag a specific revision\n\n\nYou should first set the current database with ``odb init``::\n\n    $ odb init demo8\n    Now revision 1\n\nThen you can get the current revision with ``odb info``::\n\n    $ odb info\n    database: demo8\n    revision : 1 (parent: 0)\n\nCommit the current database to create a snapshot and a new revision with ``odb commit``::\n\n    $ odb commit\n    Now revision 2\n    $ odb info\n    database: demo8\n    revision : 2 (parent: 1)\n    $ odb commit\n    Now revision 3\n    $ odb commit\n    Now revision 4\n\nYou can revert back to the last revision of the database (the parent) with ``odb revert``::\n\n    $ odb revert\n    Reverted to parent 3, now at revision 4\n\nYou can also revert back to any previous revision::\n\n    $ odb revert 2\n    Reverted to parent 2, now at revision 4\n    $ odb info\n    database: demo8\n    revision : 4 (parent: 2)\n\nYou can put tags on a revision, revert to a tag and delete a tag with ``odb tag`` and ``odb tags``::\n\n    $ odb tag v1 2\n    $ odb tag v2 3\n    $ odb tags\n    v2 (demo8*3)\n    v1 (demo8*2)\n    $ odb revert v1\n    Reverted to parent 2, now at revision 4\n    $ odb tag -d v1\n\nThe you can display all the revisions with ``odb log``::\n\n    $ odb log\n    demo8:\n        revision: 4\n        parent: 2\n    demo8*3:\n        revision: 3\n        parent: 2\n        tag: v2\n    demo8*2:\n        revision: 2\n        parent: 1\n    demo8*1:\n        revision: 1\n        parent: 0\n\nThen you can purge all the revisions except the tags::\n\n    $ odb purge keeptags\n\nor all the revisions::\n\n    $ odb purge all\n\n\n\n\nHow it works and pollutes\n-------------------------\n\n- It uses the ``CREATE DATABASE FROM TEMPLATE`` feature of PostgreSQL\n- It currently stores version information in the ``ir_config_parameter`` table\n  of Odoo (though this will change in the future).\n- It expects that the connection to PostgreSQL is done through Unix Domain\n  Socket with the current user being allowed to create and drop databases.\n- It stores the current database in ``~/.anybox.pg.odoo``\n\nwhat's next? (todo list)\n------------------------\n\n- Use a dedicated database to store version information instead of the ``ir_config_parameter`` table\n- Implement diff (#fear)\n- Improve the database naming scheme\n\nContribute\n----------\n\nMercurial repository and bug tracker: https://bitbucket.org/anybox/anybox.pg.odoo\n\nRun tests with::\n\n    $ python setup.py test\n\nChangelog\n=========\n\n0.7 (unreleased)\n----------------\n\n- fixed setting autocommit before creating new transaction\n- fixed error in Python 3\n- implement graph option ``odb log --graph``\n- fixed `issue #7\n  <https://bitbucket.org/anybox/anybox.pg.odoo/issues/7/revert-on-used-db>`_,\n  force to close exists connexion on copied database before make the copy\n- Implement `issue #4 <https://bitbucket.org/anybox/anybox.pg.odoo/issues/4/\n  limit-option-to-odb-log>`_ **limit** log option to limit number of changes\n  displayed\n\n0.6 (2014-11-02)\n----------------\n\n- fixed error in Python 3\n- remove tag and message of the current version after commit and revert\n\n0.5 (2014-10-19)\n----------------\n\n- Works on Python 3.1+\n- Works on Postgres 9.1 and maybe lower\n- ``odb purge keeptags`` : purge all but tags\n- implemented commit message\n- revert now checks that the source db exists (much safer)\n\n0.4 (2014-10-19)\n----------------\n\n- Implemented ``odb log``\n- Implemented ``odb purge``\n- Implemented ``odb tag`` and revert to tag\n- Implemented ``odb tags``\n- Renamed version to revision\n- Renamed snapshot() to commit()\n\n0.3 (2014-10-16)\n----------------\n\n- Keep the same db as the current one to work in place\n- Fixed versionning and start at 1\n- Also disconnect during revert operation\n- Removed the unneeded tip\n\n0.2 (2014-10-15 after sleeping)\n-------------------------------\n\n- Fixed packaging\n- Fixed the ``revert`` behaviour\n- Allow to revert without argument\n- Improved doc\n\n0.1 (2014-10-15)\n----------------\n\n- Initial draft\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Postgresql database snapshot versionning tool",
    "version": "0.7",
    "project_urls": null,
    "split_keywords": [
        "odb",
        "postgresql",
        "odoo",
        "snapshot",
        "commit",
        "version"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a244ce2ce25c1a7d9c7a2e490e9ea152e3048ee85fd33254ae03d8a7e5f3efcc",
                "md5": "d355ed27e48f11a1e190db966d7fa152",
                "sha256": "e9b99b30b8c59f966ab8a3a318080ee276a1a8dcb4f4e05116a8feae87ad3a17"
            },
            "downloads": -1,
            "filename": "anybox.pg.odoo-0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d355ed27e48f11a1e190db966d7fa152",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10729,
            "upload_time": "2024-02-13T13:23:46",
            "upload_time_iso_8601": "2024-02-13T13:23:46.182635Z",
            "url": "https://files.pythonhosted.org/packages/a2/44/ce2ce25c1a7d9c7a2e490e9ea152e3048ee85fd33254ae03d8a7e5f3efcc/anybox.pg.odoo-0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c743efd3ac576dd55464866ede2e47b1e93ed0a54f493e4d66c1784dc88c5f8",
                "md5": "7e74810eeb6d45d646317594e2936b81",
                "sha256": "decc5f610a7eafa53de71342ef2309e41f573aabd61329f55fa6fdec410d8e78"
            },
            "downloads": -1,
            "filename": "anybox.pg.odoo-0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "7e74810eeb6d45d646317594e2936b81",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10241,
            "upload_time": "2024-02-13T13:23:47",
            "upload_time_iso_8601": "2024-02-13T13:23:47.554551Z",
            "url": "https://files.pythonhosted.org/packages/2c/74/3efd3ac576dd55464866ede2e47b1e93ed0a54f493e4d66c1784dc88c5f8/anybox.pg.odoo-0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-13 13:23:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "anybox.pg.odoo"
}
        
Elapsed time: 0.20325s