sqlalchemy-tickets Mailing List for SQLAlchemy (Page 69)
Brought to you by:
zzzeek
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(174) |
Apr
(50) |
May
(71) |
Jun
(129) |
Jul
(113) |
Aug
(141) |
Sep
(82) |
Oct
(142) |
Nov
(97) |
Dec
(72) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(159) |
Feb
(213) |
Mar
(156) |
Apr
(151) |
May
(58) |
Jun
(166) |
Jul
(296) |
Aug
(198) |
Sep
(89) |
Oct
(133) |
Nov
(150) |
Dec
(122) |
| 2008 |
Jan
(144) |
Feb
(65) |
Mar
(71) |
Apr
(69) |
May
(143) |
Jun
(111) |
Jul
(113) |
Aug
(159) |
Sep
(81) |
Oct
(135) |
Nov
(107) |
Dec
(200) |
| 2009 |
Jan
(168) |
Feb
(109) |
Mar
(141) |
Apr
(128) |
May
(119) |
Jun
(132) |
Jul
(136) |
Aug
(154) |
Sep
(151) |
Oct
(181) |
Nov
(223) |
Dec
(169) |
| 2010 |
Jan
(103) |
Feb
(209) |
Mar
(201) |
Apr
(183) |
May
(134) |
Jun
(113) |
Jul
(110) |
Aug
(159) |
Sep
(138) |
Oct
(96) |
Nov
(116) |
Dec
(94) |
| 2011 |
Jan
(97) |
Feb
(188) |
Mar
(157) |
Apr
(158) |
May
(118) |
Jun
(102) |
Jul
(137) |
Aug
(113) |
Sep
(104) |
Oct
(108) |
Nov
(91) |
Dec
(162) |
| 2012 |
Jan
(189) |
Feb
(136) |
Mar
(153) |
Apr
(142) |
May
(90) |
Jun
(141) |
Jul
(67) |
Aug
(77) |
Sep
(113) |
Oct
(68) |
Nov
(101) |
Dec
(122) |
| 2013 |
Jan
(60) |
Feb
(77) |
Mar
(77) |
Apr
(129) |
May
(189) |
Jun
(155) |
Jul
(106) |
Aug
(123) |
Sep
(53) |
Oct
(142) |
Nov
(78) |
Dec
(102) |
| 2014 |
Jan
(143) |
Feb
(93) |
Mar
(35) |
Apr
(26) |
May
(27) |
Jun
(41) |
Jul
(45) |
Aug
(27) |
Sep
(37) |
Oct
(24) |
Nov
(22) |
Dec
(20) |
| 2015 |
Jan
(17) |
Feb
(15) |
Mar
(34) |
Apr
(55) |
May
(33) |
Jun
(31) |
Jul
(27) |
Aug
(17) |
Sep
(22) |
Oct
(26) |
Nov
(27) |
Dec
(22) |
| 2016 |
Jan
(20) |
Feb
(24) |
Mar
(23) |
Apr
(13) |
May
(17) |
Jun
(14) |
Jul
(31) |
Aug
(23) |
Sep
(24) |
Oct
(31) |
Nov
(23) |
Dec
(16) |
| 2017 |
Jan
(24) |
Feb
(20) |
Mar
(27) |
Apr
(24) |
May
(28) |
Jun
(18) |
Jul
(18) |
Aug
(23) |
Sep
(30) |
Oct
(17) |
Nov
(12) |
Dec
(12) |
| 2018 |
Jan
(27) |
Feb
(23) |
Mar
(13) |
Apr
(19) |
May
(21) |
Jun
(29) |
Jul
(11) |
Aug
(22) |
Sep
(14) |
Oct
(9) |
Nov
(24) |
Dec
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-26 00:07:18
|
#2875: attempt to improve the system by which engine_from_config locates keys w/
special values
-------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: high | Milestone: 0.9.0
Component: engine | Severity: minor - half an hour
Keywords: | Progress State: in queue
-------------------------+---------------------------------------
without resorting to just detecting ints, "True"/ "False" etc., if
dialects could somehow register additional keywords to be used by the
`_coerce_config()` method, that would help a lot. I think just let them
register their words and we kind of assume two dialects either don't use
the same kw, or if they do, they have the same type. We're dealing mostly
with booleans, should be OK.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2875>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-25 19:49:36
|
#2873: _parse_rfc1738_args removes '+' symbol from password
-----------------------------------+----------------------------------
Reporter: arun.g | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.9.0
Component: engine | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: reopened => closed
* resolution: => fixed
* status_field: in progress => completed/closed
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2873#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-25 19:49:22
|
#2873: _parse_rfc1738_args removes '+' symbol from password
------------------------------+----------------------------------
Reporter: arun.g | Owner: zzzeek
Type: defect | Status: reopened
Priority: highest | Milestone: 0.9.0
Component: engine | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in progress |
------------------------------+----------------------------------
Comment (by zzzeek):
adjusted in r6029496bd3fb78caeab349ef8df5b58f. I'm still not clear on
the parsing side, do we unconditonally deencode *any* ``%XX`` symbol? I'd
assume so, that's what it's doing.
Will send a new tweet but if folks can tell me this is right finally, that
would help.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2873#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-25 19:26:01
|
#2873: _parse_rfc1738_args removes '+' symbol from password
------------------------------+----------------------------------
Reporter: arun.g | Owner: zzzeek
Type: defect | Status: reopened
Priority: highest | Milestone: 0.9.0
Component: engine | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in progress |
------------------------------+----------------------------------
Changes (by zzzeek):
* status: closed => reopened
* priority: high => highest
* resolution: fixed =>
* status_field: completed/closed => in progress
Comment:
screwed up again:
The user name (and password), if present, are followed by a
commercial at-sign "@". Within the user and password field, any ":",
"@", or "/" must be encoded.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2873#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-24 23:15:11
|
#2874: Importing fails on Python 3.3 (attempt to import urlparse which no longer
exists)
-----------------------------------+------------------------------------
Reporter: vmalloc | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: (none) | Severity: no triage selected yet
Resolution: worksforme | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => worksforme
* status_field: awaiting triage => completed/closed
Comment:
yeah I wonder if tox is messing with the version string? we import Py2K-
isms under a conditional.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2874#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-24 23:13:40
|
#2873: _parse_rfc1738_args removes '+' symbol from password
-----------------------------------+----------------------------------
Reporter: arun.g | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.9.0
Component: engine | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* status_field: awaiting triage => completed/closed
* resolution: => fixed
* severity: trivial - <10 minutes => minor - half an hour
* milestone: 0.9.xx => 0.9.0
Comment:
I've no idea why this has never been pointed out before and the RFC is
pretty unambiguous about it. Fortunately you posted this before 0.9 final
was released so we have a chance to update this, changed in
r2800e34710672b408fa4a7bdd. For prior versions you can of course go with
a URL-encoded plus sign.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2873#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-24 22:52:11
|
#2874: Importing fails on Python 3.3 (attempt to import urlparse which no longer
exists)
----------------------------------+------------------------------------
Reporter: vmalloc | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: (none) | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by vmalloc):
I don't seem to be able to close the issue. Please feel free to close and
ignore.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2874#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-24 22:50:50
|
#2874: Importing fails on Python 3.3 (attempt to import urlparse which no longer
exists)
----------------------------------+------------------------------------
Reporter: vmalloc | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: (none) | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by vmalloc):
Oops - forget about it. Apparently this is a tox issue.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2874#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-24 22:29:19
|
#2874: Importing fails on Python 3.3 (attempt to import urlparse which no longer
exists)
---------------------+-----------------------------------------
Reporter: vmalloc | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: (none) | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
---------------------+-----------------------------------------
{{{
File "src/tests/srcfile.py", line 4, in <module>
from sqlalchemy.orm import class_mapper
File "src/.tox/py33/lib/python3.3/site-packages/sqlalchemy/__init__.py",
line 10, in <module>
from .sql import (
File "src/.tox/py33/lib/python3.3/site-
packages/sqlalchemy/sql/__init__.py", line 7, in <module>
from .expression import (
File "src/.tox/py33/lib/python3.3/site-
packages/sqlalchemy/sql/expression.py", line 34, in <module>
from .. import util, exc, inspection
File "src/.tox/py33/lib/python3.3/site-
packages/sqlalchemy/util/__init__.py", line 7, in <module>
from .compat import callable, cmp, reduce, \
File "src/.tox/py33/lib/python3.3/site-
packages/sqlalchemy/util/compat.py", line 65, in <module>
from urlparse import parse_qsl
ImportError: No module named 'urlparse'
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2874>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-24 02:29:30
|
#2873: _parse_rfc1738_args removes '+' symbol from password
--------------------+----------------------------------------
Reporter: arun.g | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.xx
Component: engine | Severity: trivial - <10 minutes
Keywords: | Progress State: awaiting triage
--------------------+----------------------------------------
AFAIK, '+' symbol only needs to be unquoted to separate form values from
URL. But why function _parse_rfc1738_args in
sqlalchemy/lib/sqlalchemy/engine/url.py uses unquote_plus on password!?
This is wrong, I think.
Following lines of code are replacing '+' symbol in password with space
causing database connection to eventually fail.
if components['password'] is not None:
components['password'] = \
util.unquote_plus(components['password'])
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2873>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 22:13:38
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
-----------------------------------+-------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: needs tests => completed/closed
Comment:
rae4629e6a0ff442a819b80f418de
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872#comment:7>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 16:56:13
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
------------------------------+-------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+-------------------------------
Changes (by zzzeek):
* status_field: in queue => needs tests
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872#comment:6>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 15:00:29
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
---------------------------+-------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-------------------------------
Comment (by zzzeek):
> To explain the metaclass: it's being used to intercept the class-
setattr() call made by ClassManager.instrument_attribute(), and store the
InstrumentedAttribute internally.
yeah you can use ext.instrumentation for that, but if you only need to
detect it as an event and not actually change the end result of
instrument_attribute, you can just use a straight event:
http://docs.sqlalchemy.org/en/rel_0_9/orm/events.html#sqlalchemy.orm.events.InstrumentationEvents.attribute_instrument
(seems like the docstring there is missing or broken, but you get the
idea).
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 13:47:32
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
---------------------------+-------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-------------------------------
Comment (by elic):
> ... Not really sure about that metaclass test though, just a simple
descriptor is all we need to illustrate?
I agree, my test was kinda overwrought... that `@hybrid_property` test is
much better, and anything that passes that should work fine for my use-
case. (So much of sqlalchemy I need to study, I wasn't aware of the
hybrid decorators until now! Gonna go read docs cover to cover this
weekend).
----
''sidenote: why the odd test...''
My test was extracted from a custom declarative layer, which puts it's
custom descriptor on the same attribute as one instrumented by SQLAlchemy
(rather having the descriptor on a different attribute, as in your test).
I thought that or some other unnoticed aspect might be important, so
wanted to replicate the bug as I found it, despite the crazy :)
To explain the metaclass: it's being used to intercept the
class-`setattr()` call made by `ClassManager.instrument_attribute()`, and
store the `InstrumentedAttribute` internally. This allows the custom
descriptor to wrap the `InstrumentedAttribute` at the instance level, but
return the `InstrumentedAttribute` unchanged at the class level. (Looking
back, I should probably update my code to use
`sqlalchemy.ext.instrumentation` instead of the metaclass hack, as I
wasn't aware of that feature when I started using sqlalchemy).
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 05:31:56
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
---------------------------+-------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-------------------------------
Comment (by zzzeek):
certainly we need some tests in hybrid for this. its just another weird
one that it hasn't come up so far.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 05:30:02
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
---------------------------+-------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-------------------------------
Comment (by zzzeek):
here's a patch I find even more interesting, that is, let the contract of
`PropComparator.adapt_to_entity()` do the work. the code here has really
been kind of ad-hoc, thinking about it now might be shedding some clarity
on what it's really supposed to be doing. the tests all pass with this
except for a few that have this odd reversal of expressions thing going
on.
{{{
#!diff
diff --git a/lib/sqlalchemy/orm/attributes.py
b/lib/sqlalchemy/orm/attributes.py
index 6071b56..a46977e 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -149,6 +149,12 @@ class QueryableAttribute(interfaces._MappedAttribute,
return self.comparator._query_clause_element()
+ def adapt_to_entity(self, adapt_to_entity):
+ assert not self._of_type
+ return self.__class__(adapt_to_entity.entity, self.key,
impl=self.impl,
+
comparator=self.comparator.adapt_to_entity(adapt_to_entity),
+ parententity=adapt_to_entity)
+
def of_type(self, cls):
return QueryableAttribute(
self.class_,
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py
index 9737072..1b8f53c 100644
--- a/lib/sqlalchemy/orm/util.py
+++ b/lib/sqlalchemy/orm/util.py
@@ -331,8 +331,10 @@ class AliasedClass(object):
else:
raise AttributeError(key)
- if isinstance(attr, attributes.QueryableAttribute):
- return _aliased_insp._adapt_prop(attr, key)
+ if isinstance(attr, PropComparator):
+ ret = attr.adapt_to_entity(_aliased_insp)
+ setattr(self, key, ret)
+ return ret
elif hasattr(attr, 'func_code'):
is_method = getattr(_aliased_insp._target, key, None)
if is_method and is_method.__self__ is not None:
@@ -343,7 +345,8 @@ class AliasedClass(object):
ret = attr.__get__(None, self)
if isinstance(ret, PropComparator):
return ret.adapt_to_entity(_aliased_insp)
- return ret
+ else:
+ return ret
else:
return attr
@@ -465,17 +468,6 @@ class AliasedInsp(_InspectionAttr):
'parentmapper': self.mapper}
)
- def _adapt_prop(self, existing, key):
- comparator = existing.comparator.adapt_to_entity(self)
- queryattr = attributes.QueryableAttribute(
- self.entity, key,
- impl=existing.impl,
- parententity=self,
- comparator=comparator)
- setattr(self.entity, key, queryattr)
- return queryattr
-
-
def _entity_for_mapper(self, mapper):
self_poly = self.with_polymorphic_mappers
if mapper in self_poly:
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 05:07:12
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
---------------------------+-------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-------------------------------
Changes (by zzzeek):
* priority: medium => high
* milestone: 0.9.xx => 0.9.0
* severity: no triage selected yet => major - 1-3 hours
* status_field: awaiting triage => in queue
Comment:
unusually, the verbal description of the case here gives us a test case
simply, whereas the test case posted here is, mmm, very scary! A
descriptor might return a `QueryableAttribute` and we need to adapt that,
so that suggests a simple @hybrid_proprerty needs this fix, and i think
you are right. Here's a patch on master:
{{{
#!diff
index 9737072..74ea592 100644
--- a/lib/sqlalchemy/orm/util.py
+++ b/lib/sqlalchemy/orm/util.py
@@ -341,9 +341,12 @@ class AliasedClass(object):
return None
elif hasattr(attr, '__get__'):
ret = attr.__get__(None, self)
- if isinstance(ret, PropComparator):
+ if isinstance(ret, attributes.QueryableAttribute):
+ return _aliased_insp._adapt_prop(ret, key)
+ elif isinstance(ret, PropComparator):
return ret.adapt_to_entity(_aliased_insp)
- return ret
+ else:
+ return ret
else:
return attr
}}}
simple test seems to show it:
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.hybrid import hybrid_property
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
data = Column(String(50))
@hybrid_property
def foo_data(self):
return self.data
print A.foo_data
a1 = aliased(A)
print a1.data
print a1.foo_data
}}}
otherwise the `QueryableAttribute._adapt_to_entity()` method that gets
called otherwise here is inadequate. At the moment it seems like that
system should be clarified - why *cant*
`QueryableAttribute._adapt_to_entity()` do the right thing? I might try
to figure out why that is. But yes, the patch you have already is the
immediate fix. Not really sure about that metaclass test though, just a
simple descriptor is all we need to illustrate?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 02:04:40
|
#2872: AliasedClass.__getattr__() creates malformed QueryableAttribute
--------------------+-----------------------------------------
Reporter: elic | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.xx
Component: orm | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
--------------------+-----------------------------------------
This an odd border case that few others will probably find themselves in,
but I ''think'' it's a bug in `sqlalchemy.orm.util.AliasedClass` (even
it's not, I'd still love if the behavior could be slightly tweaked).
Under 0.8.3 & 0.9b1, when `AliasedClass.__getattr__()` is retrieving the
attr's value, if it encounters a `QueryableAttribute`, it adapts it
accordingly. If it encounters a foreign descriptor, it calls
`descriptor.__get__(None, cls)`, then adapts the result if it's a
`PropComparator`, but otherwise returns it unchanged.
The situation I find myself in is that I have a descriptor which is itself
returning a `QueryableAttribute` instance (in particular, it's storing and
returning the `InstrumentedAttribute` that the mapper sets on the class
attribute). Since `QueryableAttribute` inherits from `PropComparator`,
the current code tries to adapt it as one, which results in a wildly
messed-up object, since `QueryableAttribute`'s call signature is very
different from what the `PropComparator`-adapter code is expecting.
My proposed change adds a check for descriptors returning
`QueryableAttribute` instances, and adapts them the same as if they were
stored directly in the class. Attached is a patch (`queryable.patch`) for
0.9, and a similar change seems to fix 0.8.
I'm happy to explain in more detail how I arrived at this situation, but I
didn't want to make this bug report overly long. Also attached is
`test_proxy_descriptor.py`, which was distilled from my actual use case,
and which demonstrates the error.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2872>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 01:05:16
|
#2867: need to not hardcode floating point scale to 10 for float types
-----------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: closed
Priority: highest | Milestone: 0.9.0
Component: sql | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: minor - half an hour => major - 1-3 hours
* status_field: needs tests => completed/closed
Comment:
r6b79d2ea7951abc2bb6083b541d
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2867#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-23 00:42:47
|
#2867: need to not hardcode floating point scale to 10 for float types
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: highest | Milestone: 0.9.0
Component: sql | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+----------------------------------
Changes (by zzzeek):
* type: defect => enhancement
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2867#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-22 23:43:15
|
#2871: UnicodeDecodeError is thrown instead of StatementError if the statement
with non-ASCII symbols lacks parameter bind value
-----------------------------------+----------------------------------
Reporter: pupssman | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: engine | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: awaiting triage => completed/closed
Comment:
the code is unclear in this regard in that the variable name `statement`
within `base.py` is used to represent SQL statements in at least three
forms; as a string, as a `Compiled` object, and as a `ClauseElement`. In
this case, the statement enters the method as a `Compiled` construct, so
in order for it to be part of the `StatementException` object's message,
we need to call its `__str__()` or `__unicode__()` method. After we get
an `ExecutionContext`, the same name `statement` is re-assigned to the
stringified SQL statement, so is then handled as a string. So the name
`statement` throughout `engine/base.py` might be better if it were renamed
to clarify its type.
thanks for the test!
rad85ab12d62e65b0310c778057551bcdd460f0d9 0.8
rf112dc1d533033f19186eb65227aba1660d03102 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2871#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-22 22:57:54
|
#2870: oracle VARCHAR w/ no length busted
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.8.xx
Component: oracle | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: no triage selected yet => minor - half an hour
* status_field: in queue => completed/closed
Comment:
r9d848680f46ffdabca84d7e2b3a4fd862d1f0bda 0.8
r467784e89c0817a74df32db4b12bd8b3e28a05df 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2870#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-22 18:02:10
|
#2871: UnicodeDecodeError is thrown instead of StatementError if the statement
with non-ASCII symbols lacks parameter bind value
----------------------+---------------------------------------
Reporter: pupssman | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: engine | Severity: minor - half an hour
Keywords: | Progress State: awaiting triage
----------------------+---------------------------------------
Environment: Ubuntu 12.04, python 2.7.3, SA 0.8.2,
sys.getdefaultencoding() => 'ascii'
What we do:
run `Session.execute` against SQL statement with a non-ASCII symbols that
declares a bind parameter but has it not fullfilled.
What do we expect:
A `StatementError` with text `A value is required for bind parameter 'x'`
is thrown
What do we observe:
A `UnicodeDecodeError` is thrown instead.
Sample script:
{{{
#!python
# encoding: utf-8
from sqlalchemy.engine import create_engine
from sqlalchemy.orm.session import sessionmaker
def test_foo():
engine = create_engine('sqlite://')
engine.execute('create table test (value varchar(100))')
session = sessionmaker(bind=engine)()
session.execute(u"""
--- КИРИЛЛИЦА
insert into test values (:x)
""")
if __name__ == '__main__':
test_foo()
}}}
In the absence of `--- КИРИЛЛИЦА` line this throws a proper
`StatementError`:
{{{
Traceback (most recent call last):
File "test_a.py", line 15, in <module>
test_foo()
File "test_a.py", line 12, in test_foo
""")
File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line
934, in execute
clause, params or {})
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
662, in execute
params)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
761, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
828, in _execute_context
None, None)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
1024, in _handle_dbapi_exception
exc_info
File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line
195, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
824, in _execute_context
context = constructor(dialect, self, conn, *args)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py",
line 438, in _init_compiled
grp, m in enumerate(parameters)]
File "/usr/lib/python2.7/dist-packages/sqlalchemy/sql/compiler.py", line
367, in construct_params
% bindparam.key)
sqlalchemy.exc.StatementError: A value is required for bind parameter u'x'
(original cause: InvalidRequestError: A value is required for bind
parameter u'x') '\n insert into test values (?)\n ' [{}]
}}}
But the actual error is:
{{{
Traceback (most recent call last):
File "test_a.py", line 16, in <module>
test_foo()
File "test_a.py", line 13, in test_foo
""")
File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line
934, in execute
clause, params or {})
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
662, in execute
params)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
761, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
827, in _execute_context
str(statement), parameters,
UnicodeEncodeError: 'ascii' codec can't encode characters in position
9-17: ordinal not in range(128)
}}}
This is causes here:
https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/engine/base.py#L827
Strangely, but it is the only place where `str(statement)` is called in
preparation for `self._handle_dbapi_exception` call. Looks like the `str`
part is superfluous.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2871>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-22 15:22:05
|
#2870: oracle VARCHAR w/ no length busted
---------------------+-----------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.8.xx
Component: oracle | Severity: no triage selected yet
Keywords: | Progress State: in queue
---------------------+-----------------------------------------
{{
#!python
from sqlalchemy import *
from sqlalchemy.sql import column
from sqlalchemy.dialects import oracle
print cast(column('x'), String)
print cast(column('x'), String).compile(dialect=oracle.dialect())
}}}
prints "CAST(x AS VARCHAR2(None CHAR))"
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2870>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-21 22:19:21
|
#2868: quoted_name fails to repr()
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.9.0
Component: schema | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: reopened => closed
* resolution: => fixed
Comment:
9499b88f85e814e24c8fac7e0b932d3c
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2868#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|