Hi,

as stated in 
https://docs.sqlalchemy.org/en/20/dialects/postgresql.html#range-and-multirange-types,
 
in SA 2.0 the PG "range" (and "multirange") types are wrapped in a new
Range class, while the underlying driver-specific class is "hidden"
within the dialect implementation.

This means that many operations that were previously exposed to the
Python logic are not available anymore, and I'm not sure if that is
intentional, not-yet-implemented functionalities or instead just me
missing something.

For example, one of the trickiest things I would need to reimplement is
the Python-side equivalent of the "<@" operator, that checks whether an
element is contained in a range: in SA 1.x this was readily exposed by
the driver implementation, usually by a `__contains__` method
(see https://github.com/psycopg/psycopg2/blob/master/lib/_range.py#L121
for psycopg2).

What do you foresee, that the Range class should/will "proxies" those
capabilities, or instead that I should change (pseudo)code like::

  class Contract:
     active = Column(bool)
     validity = Column(daterange)
     
     def is_currently_active(self):
        return self.active and date.today() in self.validity

to something different, that in some way "reaches" the underlying
psycopg (say) implementation and uses its logic?

Thanks in advance,
ciao, lele.
-- 
nickname: Lele Gaifax | Dire che Emacs è "conveniente" è come
real: Emanuele Gaifas | etichettare l'ossigeno come "utile"
[email protected]      |                           -- Rens Troost

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/87o7u4f7me.fsf%40metapensiero.it.

Reply via email to