Hi,in SA 2.0 the PG "range" (and "multirange") types are wrapped in a newRange class, while the underlying driver-specific class is "hidden"within the dialect implementation.This means that many operations that were previously exposed to thePython logic are not available anymore, and I'm not sure if that isintentional, not-yet-implemented functionalities or instead just memissing something.
For example, one of the trickiest things I would need to reimplement isthe Python-side equivalent of the "<@" operator, that checks whether anelement is contained in a range: in SA 1.x this was readily exposed bythe driver implementation, usually by a `__contains__` methodfor psycopg2).
What do you foresee, that the Range class should/will "proxies" thosecapabilities, or instead that I should change (pseudo)code like::
"Mike Bayer" <mik...@zzzcomputing.com> writes:> Range is a really simple dataclass so adding a few simple value> methods contains_value(), issubset(), issuperset() is a PR (with> tests) away. there's no need to "proxy" things, these are pretty> obvious methods to just implement directly. I would just disagree with> psycopg2's more nonsensical methods like `__lt__`, `__gt__`, etc.>Thank you for the directions: while I'm not 100% convinced aboutavoiding __contains__(), which seems very intuitive and practical, Iwill propose a PR soon.
ciao, lele.--nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ierireal: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.le...@metapensiero.it | -- Fortunato Depero, 1929.
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo 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 sqlalchemy+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/87ilkb9cvm.fsf%40metapensiero.it.
Lele Gaifax <le...@metapensiero.it> writes:> I will propose a PR soon.An ethical concern: given that the proposed methods are so simple, is itlegal/acceptable to verbatim copy them, and their tests, from thepsycopg (LGPL) and asyncpg (Apache license)?
ciao, lele.--nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ierireal: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.le...@metapensiero.it | -- Fortunato Depero, 1929.
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo 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 sqlalchemy+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/878rl6ap2z.fsf%40metapensiero.it.
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo 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 sqlalchemy+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/878rl5uqbq.fsf%40metapensiero.it.
"Mike Bayer" <mik...@zzzcomputing.com> writes:> these look super great!Thanks! I will then open an issue and a related PR shortly.> We can make the text("") statements into something nicer in a second> pass, is that the part you didn't like ?Not exactly: I spent some time trying to avoid the "redundancy" in thetests parametrization, ie@testing.combinations((Range(empty=True), 'empty'),(Range(None, None, bounds='()'), '(,)'),(Range(None, 4, bounds='(]'), '(,4]'),...ideally simplifying it to@testing.combinations(Range(empty=True),Range(None, None, bounds='()'),Range(None, 4, bounds='(]'),...and then being able to "compute" the SQL query from the given Rangeinstance alone, but I couldn't figure out how to obtain the"compilation" of just a single value from the connection.dialect.But hey, I do not expected those arguments will be changing often... :-)
ciao, lele--nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ierireal: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.le...@metapensiero.it | -- Fortunato Depero, 1929.
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo 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 sqlalchemy+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/874jvtukxz.fsf%40metapensiero.it.