StormSpans brings support for PostgreSQL's range types to Canonical's Storm ORM using PsycoSpans paired with Spans.
This package's functionality probably be merged with storm-legacy in the future.
Psycospans exists on PyPI.
pip install psycospans
For full doumentation please run pydoc stormspans
from a shell.
from spans import intrange
from storm.locals import *
from stormspans import IntRange
class Model(Storm):
id = Int(primary=True)
span = IntRange(default=intrange(1, 10))
def __init__(self, span):
self.span = span
# NOTE: URI must start with postgres+spans://
store = Store(create_database("postgres+spans://<url>"))
store.execute("""
CREATE TABLE int_range_test(
id SERIAL,
span int4range
)
""")
store.add(Model(intrange(1, 100))
store.commit()
Released on 9th October 2018
- Added support for storm-legacy
- Added support for Python 3.4 and later. Note that this only work with
storm-legacy
since Storm is not Python 3 compatible
Released 12th June 2014
- Initial commit