SQLAlchemy-Utc


NameSQLAlchemy-Utc JSON
Version 0.14.0 PyPI version JSON
download
home_pagehttps://github.com/spoqa/sqlalchemy-utc
SummarySQLAlchemy type to store aware datetime values
upload_time2021-09-24 04:37:58
maintainer
docs_urlNone
authorHong Minhee
requires_python
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            SQLAlchemy-Utc
==============

.. image:: https://badge.fury.io/py/SQLAlchemy-Utc.svg?
   :target: https://pypi.python.org/pypi/SQLAlchemy-Utc
.. image:: https://travis-ci.com/spoqa/sqlalchemy-utc.svg?branch=master
   :target: https://travis-ci.com/spoqa/sqlalchemy-utc
.. image:: https://codecov.io/github/spoqa/sqlalchemy-utc/coverage.svg?branch=master
   :target: https://codecov.io/github/spoqa/sqlalchemy-utc?branch=master

This package provides a drop-in replacement of SQLAlchemy's built-in `DateTime`_
type with ``timezone=True`` option enabled.  Although SQLAlchemy's built-in
``DateTime`` type provides ``timezone=True`` option, since some vendors like
SQLite and MySQL don't provide ``timestamptz`` data type, the option doesn't
make any effect on these vendors.

``UtcDateTime`` type is equivalent to the built-in ``DateTime`` with
``timezone=True`` option enabled on vendors that support ``timestamptz``
e.g. PostgreSQL, but on SQLite or MySQL, it shifts all ``datetime.datetime``
values to UTC offset before store them, and returns always aware
``datetime.datetime`` values through result sets.

Long story short, ``UtcDateTime`` does:

- take only aware ``datetime.datetime``,
- return only aware ``datetime.datetime``,
- never take or return naive ``datetime.datetime``,
- ensure timestamps in database always to be encoded in UTC, and
- work as you'd expect.

A SQLAlchemy helper function, ``utcnow()``, is provided as an alternative
to ``func.now()`` for generating ``UtcDateTime`` values on the server. For
example: ``Column('time', UtcDateTime(), default=utcnow())``.

Written by `Hong Minhee`_ at Spoqa_, and distributed under MIT license.

.. _DateTime: http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.DateTime
.. _Hong Minhee: https://hongminhee.org/
.. _Spoqa: http://www.spoqa.com/


Changelog
=========

0.14.0
------

Released on September 24, 2021.

- Add cache_ok flag on ``UtcDateTime`` to supress Pandas warnings.
  [`#14`_ by derekderie]

.. _#14: https://github.com/spoqa/sqlalchemy-utc/pull/14


0.13.0
------

Released on September 24, 2021.

- Add milliseconds to SQLite datetimes.  [`#12`_ by Giovanni Santini]
- Add support for newer python versions. (3.7, 3.8, 3.9)
  [`#12`_ by Giovanni Santini]

.. _#12: https://github.com/spoqa/sqlalchemy-utc/pull/12


0.12.0
------

Released on May 7, 2021.

- Add `py.typed` file to the package to be compatible with PEP-561.
  [`#10`_ by Dima Boger]

.. _#10: https://github.com/spoqa/sqlalchemy-utc/pull/10


0.11.0
------

Released on November 13, 2020.

- Ensured always returning the datetime with UTC timezone.
  [`#8`_ by Eduard Christian Dumitrescu]

.. _#8: https://github.com/spoqa/sqlalchemy-utc/pull/8


0.10.0
------

Released on January 25, 2018.

- Dropped support of older Python versions: 2.6, 3.2, and 3.3.
  [`#2`_ by George Leslie-Waksman]
- Added ``sqlalchemy_utc.utcnow()`` function as an alternative to
  ``sqlalchemy.sql.functions.now()`` for generating ``UtcDateTime`` values
  on the database server.  [`#4`_ by George Leslie-Waksman]

.. _#2: https://github.com/spoqa/sqlalchemy-utc/pull/2
.. _#4: https://github.com/spoqa/sqlalchemy-utc/pull/4


0.9.0
-----

First version.  Released on June 22, 2016.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/spoqa/sqlalchemy-utc",
    "name": "SQLAlchemy-Utc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Hong Minhee",
    "author_email": "hongminhee@member.fsf.org",
    "download_url": "https://files.pythonhosted.org/packages/5c/db/2d8f421cece2758954278bd16e05e3f73ce86c0062577a1ccfd3eb4208cd/SQLAlchemy-Utc-0.14.0.tar.gz",
    "platform": "",
    "description": "SQLAlchemy-Utc\n==============\n\n.. image:: https://badge.fury.io/py/SQLAlchemy-Utc.svg?\n   :target: https://pypi.python.org/pypi/SQLAlchemy-Utc\n.. image:: https://travis-ci.com/spoqa/sqlalchemy-utc.svg?branch=master\n   :target: https://travis-ci.com/spoqa/sqlalchemy-utc\n.. image:: https://codecov.io/github/spoqa/sqlalchemy-utc/coverage.svg?branch=master\n   :target: https://codecov.io/github/spoqa/sqlalchemy-utc?branch=master\n\nThis package provides a drop-in replacement of SQLAlchemy's built-in `DateTime`_\ntype with ``timezone=True`` option enabled.  Although SQLAlchemy's built-in\n``DateTime`` type provides ``timezone=True`` option, since some vendors like\nSQLite and MySQL don't provide ``timestamptz`` data type, the option doesn't\nmake any effect on these vendors.\n\n``UtcDateTime`` type is equivalent to the built-in ``DateTime`` with\n``timezone=True`` option enabled on vendors that support ``timestamptz``\ne.g. PostgreSQL, but on SQLite or MySQL, it shifts all ``datetime.datetime``\nvalues to UTC offset before store them, and returns always aware\n``datetime.datetime`` values through result sets.\n\nLong story short, ``UtcDateTime`` does:\n\n- take only aware ``datetime.datetime``,\n- return only aware ``datetime.datetime``,\n- never take or return naive ``datetime.datetime``,\n- ensure timestamps in database always to be encoded in UTC, and\n- work as you'd expect.\n\nA SQLAlchemy helper function, ``utcnow()``, is provided as an alternative\nto ``func.now()`` for generating ``UtcDateTime`` values on the server. For\nexample: ``Column('time', UtcDateTime(), default=utcnow())``.\n\nWritten by `Hong Minhee`_ at Spoqa_, and distributed under MIT license.\n\n.. _DateTime: http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.DateTime\n.. _Hong Minhee: https://hongminhee.org/\n.. _Spoqa: http://www.spoqa.com/\n\n\nChangelog\n=========\n\n0.14.0\n------\n\nReleased on September 24, 2021.\n\n- Add cache_ok flag on ``UtcDateTime`` to supress Pandas warnings.\n  [`#14`_ by derekderie]\n\n.. _#14: https://github.com/spoqa/sqlalchemy-utc/pull/14\n\n\n0.13.0\n------\n\nReleased on September 24, 2021.\n\n- Add milliseconds to SQLite datetimes.  [`#12`_ by Giovanni Santini]\n- Add support for newer python versions. (3.7, 3.8, 3.9)\n  [`#12`_ by Giovanni Santini]\n\n.. _#12: https://github.com/spoqa/sqlalchemy-utc/pull/12\n\n\n0.12.0\n------\n\nReleased on May 7, 2021.\n\n- Add `py.typed` file to the package to be compatible with PEP-561.\n  [`#10`_ by Dima Boger]\n\n.. _#10: https://github.com/spoqa/sqlalchemy-utc/pull/10\n\n\n0.11.0\n------\n\nReleased on November 13, 2020.\n\n- Ensured always returning the datetime with UTC timezone.\n  [`#8`_ by Eduard Christian Dumitrescu]\n\n.. _#8: https://github.com/spoqa/sqlalchemy-utc/pull/8\n\n\n0.10.0\n------\n\nReleased on January 25, 2018.\n\n- Dropped support of older Python versions: 2.6, 3.2, and 3.3.\n  [`#2`_ by George Leslie-Waksman]\n- Added ``sqlalchemy_utc.utcnow()`` function as an alternative to\n  ``sqlalchemy.sql.functions.now()`` for generating ``UtcDateTime`` values\n  on the database server.  [`#4`_ by George Leslie-Waksman]\n\n.. _#2: https://github.com/spoqa/sqlalchemy-utc/pull/2\n.. _#4: https://github.com/spoqa/sqlalchemy-utc/pull/4\n\n\n0.9.0\n-----\n\nFirst version.  Released on June 22, 2016.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "SQLAlchemy type to store aware datetime values",
    "version": "0.14.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "0d0fef7ff6cc8ad94be3b85d4d421b82",
                "sha256": "d2379eed5cce372128b5e744ce382decd262b2c742ab31f7f22ca11c6647f60b"
            },
            "downloads": -1,
            "filename": "SQLAlchemy_Utc-0.14.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0d0fef7ff6cc8ad94be3b85d4d421b82",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 5979,
            "upload_time": "2021-09-24T04:37:56",
            "upload_time_iso_8601": "2021-09-24T04:37:56.555017Z",
            "url": "https://files.pythonhosted.org/packages/e7/89/ccfe4b579784f852c64f0fcb127e560990c2d75a2514dda51a9c87fb3782/SQLAlchemy_Utc-0.14.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "058814689d97a716d1a8f7388fcda085",
                "sha256": "8e041624595b66d7b1d5ea8b6de486df5c1b9352697f3b24f862f0ded56cd7aa"
            },
            "downloads": -1,
            "filename": "SQLAlchemy-Utc-0.14.0.tar.gz",
            "has_sig": false,
            "md5_digest": "058814689d97a716d1a8f7388fcda085",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5353,
            "upload_time": "2021-09-24T04:37:58",
            "upload_time_iso_8601": "2021-09-24T04:37:58.190154Z",
            "url": "https://files.pythonhosted.org/packages/5c/db/2d8f421cece2758954278bd16e05e3f73ce86c0062577a1ccfd3eb4208cd/SQLAlchemy-Utc-0.14.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-09-24 04:37:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "spoqa",
    "github_project": "sqlalchemy-utc",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "sqlalchemy-utc"
}
        
Elapsed time: 0.02304s