sqlalchemy-tickets Mailing List for SQLAlchemy (Page 70)
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-21 20:20:56
|
#2868: quoted_name fails to repr()
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: reopened
Priority: highest | Milestone: 0.9.0
Component: schema | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: closed => reopened
* resolution: fixed =>
Comment:
totally wrong, the test is hardcoded to python 2, u'' is coming out in
repr now screwing up other tests. try again
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2868#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-21 18:51:31
|
#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: new => closed
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
r42fd77a4bfb8c5a1c02c89a17
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2868#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-21 18:50:57
|
#2869: serializer with non-ascii names
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
r3a3aeb431e08277346078fe60437f1fcfde957e2 0.8
r2aa00c49d7a1a783ff50832f2de77 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2869#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-21 18:28:45
|
#2869: serializer with non-ascii names
--------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an hour
Keywords: | Progress State: in progress
--------------------+---------------------------------------
{{{
#!python
# coding: utf-8
from sqlalchemy import *
from sqlalchemy.util import ue
from sqlalchemy.ext import serializer
m = MetaData()
t = Table(ue('\u6e2c\u8a66'), m,
Column(ue('\u6e2c\u8a66_id'), Integer))
expr = select([t]).where(t.c[ue('\u6e2c\u8a66_id')] == 5)
expr2 = serializer.loads(serializer.dumps(expr, -1), m)
print expr2
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2869>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-21 18:20:27
|
#2868: quoted_name fails to repr()
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.0
Component: schema | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in progress |
------------------------------+----------------------------------
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2868#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-21 18:01:13
|
#2868: table.description usage conflicting with quoted name stuff
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.0
Component: schema | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in progress |
------------------------------+----------------------------------
Changes (by zzzeek):
* milestone: 0.8.xx => 0.9.0
Comment:
OK this is partially a regression caused by the quoted_name stuff, so it's
for 0.9.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2868#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-21 17:59:57
|
#2868: inappropiate use of table.description
---------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.8.xx
Component: schema | Severity: minor - half an hour
Keywords: | Progress State: in progress
---------------------+---------------------------------------
e.g.
{{{
#!python
# coding: utf-8
from sqlalchemy import *
from sqlalchemy.util import ue
m = MetaData()
t = Table(ue('\u6e2c\u8a66'), m, Column(ue('\u6e2c\u8a66_id'), Integer))
print repr(t)
}}}
encode error!
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2868>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-20 15:40:18
|
#2867: need to not hardcode floating point scale to 10 for float types
---------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.0
Component: sql | Severity: minor - half an hour
Keywords: | Progress State: needs tests
---------------------+---------------------------------------
patch attached
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2867>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-20 00:30:04
|
#2848: RowProxy don't get sorted as expected
-----------------------------------+----------------------------------
Reporter: pakal | 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
* resolution: => fixed
* status_field: needs tests => completed/closed
Comment:
r02f21ffcf366da406795334d2fc6908
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2848#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-20 00:17:25
|
#2833: viewonly=True should prevent object from marked as dirty
-----------------------------------+-------------------------------
Reporter: zzzeek | 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: in queue => completed/closed
Comment:
r63508b82cd5710c660383bcac5
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2833#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-19 19:32:55
|
#2866: create kwarg registration system for dialect kwargs, build into
_valdidate_dialect_kwargs
---------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.0
Component: schema | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-------------------------------
Changes (by zzzeek):
* milestone: 0.9.xx => 0.9.0
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2866#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-19 00:12:01
|
#2501: the DELETE before INSERT problem
------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.xx
Component: orm | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+---------------------------------------
Changes (by joshma):
* cc: josh@… (added)
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2501#comment:20>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-18 15:06:29
|
#2866: create kwarg registration system for dialect kwargs, build into
_valdidate_dialect_kwargs
--------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.xx
Component: schema | Severity: major - 1-3 hours
Keywords: | Progress State: in queue
--------------------+------------------------------------
so that operations like Index(..., postresql_where=...) as well as args
not known "postgresql_imfake" can raise an error. To handle entrypoint
dialects, the system would actually need to resolve an entrypoint upon
receipt of an unregistered dialect name as a kwarg.
for an error against "postresql_where", it would be like, "Can't locate
any dialect named 'postresql'" after it searched entrypoints.
for an error against "postgresql_imfake", the Postgresql dialect itself
would have registered all available kwargs such as "postgresql_where" and
such, and the error can say "no dialect option postgresql_imfake
registered for the postgresql dialect".
also Index needs _validate_dialect_kwargs added.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2866>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-18 02:54:03
|
#2581: PostgreSQL-9.2 JSON datatype
------------------------------+-------------------------------
Reporter: plaes | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.8.xx
Component: postgres | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
------------------------------+-------------------------------
Changes (by whitemice):
* cc: awilliam@… (added)
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2581#comment:14>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-16 22:32:10
|
#2865: declarative reflective base needs to handle "secondary"
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: declarative | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+----------------------------------
Comment (by zzzeek):
so it might be nice to figure out if _class_resolver() above could have
some kind of hook that deferred reflection latches onto. patch coming
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2865#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-16 22:21:08
|
#2865: declarative reflective base needs to handle "secondary"
-------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: declarative | Severity: minor - half an hour
Keywords: | Progress State: needs tests
-------------------------+---------------------------------------
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base,
DeferredReflection
Base = declarative_base(cls=DeferredReflection)
class A(Base):
__tablename__ = 'a'
bs = relationship("B", secondary="atob")
class B(Base):
__tablename__ = 'b'
e = create_engine("sqlite://", echo=True)
e.execute("""
create table a(id integer primary key)
""")
e.execute("""
create table b(id integer primary key)
""")
e.execute("""
create table atob(
a_id integer references a(id),
b_id integer references b(id),
primary key (a_id, b_id)
)
""")
Base.prepare(e)
# if this isn't done, failure
#Table('atob', Base.metadata, autoload=True, autoload_with=e)
print A.bs.__clause_element__()
}}}
patch:
{{{
#!diff
diff --git a/lib/sqlalchemy/ext/declarative/api.py
b/lib/sqlalchemy/ext/declarative/api.py
index b309a78..5a8009f 100644
--- a/lib/sqlalchemy/ext/declarative/api.py
+++ b/lib/sqlalchemy/ext/declarative/api.py
@@ -9,9 +9,10 @@
from ...schema import Table, MetaData
from ...orm import synonym as _orm_synonym, mapper,\
comparable_property,\
- interfaces
+ interfaces, properties
from ...orm.util import polymorphic_union
from ...orm.base import _mapper_or_none
+from ...util import compat
from ... import exc
import weakref
@@ -470,6 +471,18 @@ class DeferredReflection(object):
for thingy in to_map:
cls._sa_decl_prepare(thingy.local_table, engine)
thingy.map()
+ for rel in thingy.cls.__mapper__._props.values():
+ if isinstance(rel, properties.RelationshipProperty) and \
+ rel.secondary is not None:
+ if isinstance(rel.secondary, Table):
+ cls._sa_decl_prepare(rel.secondary, engine)
+ elif callable(rel.secondary) and \
+ hasattr(rel.secondary, '_declarative_arg'):
+ cls._sa_decl_prepare(
+ Table(
+ rel.secondary._declarative_arg,
+ cls.metadata,
+ ), engine)
@classmethod
def _sa_decl_prepare(cls, local_table, engine):
diff --git a/lib/sqlalchemy/ext/declarative/clsregistry.py
b/lib/sqlalchemy/ext/declarative/clsregistry.py
index a669e37..f11c7a1 100644
--- a/lib/sqlalchemy/ext/declarative/clsregistry.py
+++ b/lib/sqlalchemy/ext/declarative/clsregistry.py
@@ -225,47 +225,56 @@ def _determine_container(key, value):
return _GetColumns(value)
-def _resolver(cls, prop):
- def resolve_arg(arg):
- import sqlalchemy
- from sqlalchemy.orm import foreign, remote
-
- fallback = sqlalchemy.__dict__.copy()
- fallback.update({'foreign': foreign, 'remote': remote})
-
- def access_cls(key):
- if key in cls._decl_class_registry:
- return _determine_container(key,
cls._decl_class_registry[key])
- elif key in cls.metadata.tables:
- return cls.metadata.tables[key]
- elif key in cls.metadata._schemas:
- return _GetTable(key, cls.metadata)
- elif '_sa_module_registry' in cls._decl_class_registry and \
- key in cls._decl_class_registry['_sa_module_registry']:
- registry =
cls._decl_class_registry['_sa_module_registry']
- return registry.resolve_attr(key)
+class _class_resolver(object):
+ def __init__(self, cls, prop, fallback, arg):
+ self.cls = cls
+ self.prop = prop
+ self.arg = self._declarative_arg = arg
+ self.fallback = fallback
+ self._dict = util.PopulateDict(self._access_cls)
+
+ def _access_cls(self, key):
+ cls = self.cls
+ if key in cls._decl_class_registry:
+ return _determine_container(key,
cls._decl_class_registry[key])
+ elif key in cls.metadata.tables:
+ return cls.metadata.tables[key]
+ elif key in cls.metadata._schemas:
+ return _GetTable(key, cls.metadata)
+ elif '_sa_module_registry' in cls._decl_class_registry and \
+ key in cls._decl_class_registry['_sa_module_registry']:
+ registry = cls._decl_class_registry['_sa_module_registry']
+ return registry.resolve_attr(key)
+ else:
+ return self.fallback[key]
+
+ def __call__(self):
+ try:
+ x = eval(self.arg, globals(), self._dict)
+
+ if isinstance(x, _GetColumns):
+ return x.cls
else:
- return fallback[key]
+ return x
+ except NameError as n:
+ raise exc.InvalidRequestError(
+ "When initializing mapper %s, expression %r failed to "
+ "locate a name (%r). If this is a class name, consider "
+ "adding this relationship() to the %r class after "
+ "both dependent classes have been defined." %
+ (self.prop.parent, self.arg, n.args[0], self.cls)
+ )
- d = util.PopulateDict(access_cls)
- def return_cls():
- try:
- x = eval(arg, globals(), d)
+def _resolver(cls, prop):
+ import sqlalchemy
+ from sqlalchemy.orm import foreign, remote
- if isinstance(x, _GetColumns):
- return x.cls
- else:
- return x
- except NameError as n:
- raise exc.InvalidRequestError(
- "When initializing mapper %s, expression %r failed to
"
- "locate a name (%r). If this is a class name,
consider "
- "adding this relationship() to the %r class after "
- "both dependent classes have been defined." %
- (prop.parent, arg, n.args[0], cls)
- )
- return return_cls
+ fallback = sqlalchemy.__dict__.copy()
+ fallback.update({'foreign': foreign, 'remote': remote})
+
+ def resolve_arg(arg):
+ return _class_resolver(cls, prop, fallback, arg)
return resolve_arg
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2865>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-14 18:35:29
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
---------------------------+-----------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: oracle | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Comment (by Bluehorn):
Replying to [comment:4 zzzeek]:
> this could be improved if is_disconnect also gave out info regarding
"try to close" or not, then we'd have to get that all into the pool logic
and such, not sure if I'm eager to get into that as the pool's stability
is pretty critical.
I would try to improve the Oracle dialect class to check if the connection
is still alive before trying to close it. I did not find any method in
cx_Oracle to check that though. Perhaps later :)
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-14 18:32:01
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
---------------------------+-----------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: oracle | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Comment (by zzzeek):
well the connection is "invalidated" when we detect disconnect but we
don't assume that means "closed", for safety we run a "safe close", as
you've noticed we don't propagate the exception there as we're expecting
it to fail in many cases, this gets logged. it's normal when an
unexpected disconnect happens. this could be improved if is_disconnect
also gave out info regarding "try to close" or not, then we'd have to get
that all into the pool logic and such, not sure if I'm eager to get into
that as the pool's stability is pretty critical.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-14 18:27:43
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
---------------------------+-----------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: oracle | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Comment (by Bluehorn):
Replying to [comment:2 zzzeek]:
> OK so we just need to add 2396 to the list, right?
Correct. For bonus points it would be great if closing a closed connection
would not log to the error level. We currently generate automatic bug
reports from that :-)
However I have no idea how to fix that and I guess that's more of a bug in
cx_Oracle.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-14 18:07:41
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
---------------------------+-----------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: oracle | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Changes (by zzzeek):
* status_field: awaiting triage => in queue
* severity: no triage selected yet => trivial - <10 minutes
* milestone: => 0.8.xx
Comment:
OK so we just need to add 2396 to the list, right?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-14 17:31:01
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
----------------------------------+------------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: oracle | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by Bluehorn):
I forgot to mention how to configure the database server so that the
connection is actually sniped. I used the following SQL commands (as
sysdba) to restrict the example user loco_tl to one minute of idle time
before being sniped. Note that Oracle does not check the expiration very
often which means that I had to wait three minutes on average to have the
connection really cut. I used attachment:list_sessions.sql to check when
my connection was really sniped.
`CREATE PROFILE short_idle LIMIT IDLE_TIME 1;`
# see
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_6010.htm#SQLRF54200
`ALTER USER loco_tl PROFILE short_idle;`
# see
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_4003.htm
`ALTER SYSTEM SET RESOURCE_LIMIT = TRUE;`
# see
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_2013.htm#i2198497
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-14 17:18:32
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
----------------------+-----------------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: oracle | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
----------------------+-----------------------------------------
tl;dr: Error code ORA-02396 is missing in
`OracleDialect_cx_oracle.is_disconnect`.
We have an application where the Oracle server is configured to
automatically disconnect clients by the IDLE_TIME resource limit. This
leads to the ORA-02396 error code, which is never seen from the
application side.
Example code:
{{{
#!python
import logging
from sqlalchemy import *
from sqlalchemy.exc import DBAPIError
demo_query = "select 42 from dual"
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
engine = create_engine("oracle://loco_tl:loco_tl@loco_tl") # XXX:
Adjust database URL
print "Running a query from a fresh engine:"
print "SQL: %r -> %r" % (demo_query,
engine.execute(demo_query).scalar())
print "Status of the connection pool: %s" % engine.pool.status()
print "Press enter after connection was sniped by Oracle."
raw_input()
try:
print "Running the query from the same engine:"
print "SQL: %r -> %r" % (demo_query,
engine.execute(demo_query).scalar())
except DBAPIError, e:
if not e.connection_invalidated:
raise
print "Connection was invalidated, retrying:"
print "SQL: %r -> %r" % (demo_query,
engine.execute(demo_query).scalar())
}}}
Expected output in my case:
{{{
$ python initial.py
Running a query from a fresh engine:
SQL: 'select 42 from dual' -> 42
Status of the connection pool: Pool size: 5 Connections in pool: 1
Current Overflow: -4 Current Checked out connections: 0
Press enter after connection was sniped by Oracle.
Running the query from the same engine:
Connection was invalidated, retrying:
SQL: 'select 42 from dual' -> 42
}}}
Instead I get the following output:
{{{
$ python initial.py
Running a query from a fresh engine:
SQL: 'select 42 from dual' -> 42
Status of the connection pool: Pool size: 5 Connections in pool: 1
Current Overflow: -4 Current Checked out connections: 0
Press enter after connection was sniped by Oracle.
Running the query from the same engine:
ERROR:sqlalchemy.pool.QueuePool:Exception closing connection
<cx_Oracle.Connection to loco_tl@loco_tl>
Traceback (most recent call last):
File "../python2.7/site-packages/sqlalchemy/pool.py", line 191, in
_close_connection
self._dialect.do_close(connection)
File "../python2.7/site-packages/sqlalchemy/engine/default.py", line
352, in do_close
dbapi_connection.close()
OperationalError: ORA-01012: not logged on
Process ID: 25873
Session ID: 25 Serial number: 10916
Traceback (most recent call last):
File "initial.py", line 23, in <module>
print "SQL: %r -> %r" % (demo_query,
engine.execute(demo_query).scalar())
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 1598,
in execute
return connection.execute(statement, *multiparams, **params)
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 656,
in execute
return self._execute_text(object, multiparams, params)
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 805,
in _execute_text
statement, parameters
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 874,
in _execute_context
context)
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 1013,
in _handle_dbapi_exception
self._autorollback()
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 556,
in _autorollback
self._rollback_impl()
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 476,
in _rollback_impl
self._handle_dbapi_exception(e, None, None, None, None)
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 991,
in _handle_dbapi_exception
exc_info
File "../python2.7/site-packages/sqlalchemy/util/compat.py", line 185,
in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "../python2.7/site-packages/sqlalchemy/engine/base.py", line 473,
in _rollback_impl
self.engine.dialect.do_rollback(self.connection)
File "../python2.7/site-packages/sqlalchemy/engine/default.py", line
346, in do_rollback
dbapi_connection.rollback()
sqlalchemy.exc.OperationalError: (OperationalError) ORA-01012: not logged
on
Process ID: 25873
Session ID: 25 Serial number: 10916
None None
}}}
My current solution is to replace the Oracle dialect like this (which
would also make a nice addition to the documentation I think because it
shows how to overwrite specifics of a dialect class):
{{{
#!python
from sqlalchemy.dialects import registry, oracle
class MyOracleDialect(oracle.cx_oracle.OracleDialect_cx_oracle):
def is_disconnect(self, e, connection, cursor):
error, = e.args
if isinstance(e, self.dbapi.InterfaceError):
return "not connected" in str(e)
elif hasattr(error, 'code'):
# logging.info("MyOracleDialect.is_disconnect: ORA-%s",
error.code)
# ORA-00028: your session has been killed
# ORA-03114: not connected to ORACLE
# ORA-03113: end-of-file on communication channel
# ORA-03135: connection lost contact
# ORA-01033: ORACLE initialization or shutdown in progress
# ORA-02396: exceeded maximum idle time, please connect again
# TODO: Others ?
return error.code in (28, 3114, 3113, 3135, 1033, 2396)
else:
return False
registry.register("oracle", __name__, "MyOracleDialect")
}}}
With this addition the actual behaviour still falls a bit short but is
good enough for us:
{{{
$ python fixed.py
Running a query from a fresh engine:
SQL: 'select 42 from dual' -> 42
Status of the connection pool: Pool size: 5 Connections in pool: 1
Current Overflow: -4 Current Checked out connections: 0
Press enter after connection was sniped by Oracle.
Running the query from the same engine:
ERROR:sqlalchemy.pool.QueuePool:Exception closing connection
<cx_Oracle.Connection to loco_tl@loco_tl>
Traceback (most recent call last):
File "../python2.7/site-packages/sqlalchemy/pool.py", line 191, in
_close_connection
self._dialect.do_close(connection)
File "../python2.7/site-packages/sqlalchemy/engine/default.py", line
352, in do_close
dbapi_connection.close()
OperationalError: ORA-01012: not logged on
Process ID: 23387
Session ID: 58 Serial number: 6081
Connection was invalidated, retrying:
SQL: 'select 42 from dual' -> 42
}}}
It is unfortunate that closing the connection fails here as it was in fact
closed (or rather disabled) on the server side. Doesn't really matter for
us as the message does not do any harm other than adding a bit to the log
files.
Tested with the following version of SQLAlchemy:
{{{
#!sh
torsten@sharokan:~/workspace/sqlalchemy$ git describe --tags
rel_0_9_0b1-12-g5d0e844
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-13 16:46:30
|
#2863: ParseError on installation, Python 3.3
-----------------------------------+-----------------------------------
Reporter: Julian_O | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: trivial - <10 minutes
Resolution: wontfix | Keywords:
Progress State: completed/closed |
-----------------------------------+-----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => wontfix
* status_field: in queue => completed/closed
Comment:
fine by me
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2863#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-13 16:34:47
|
#2863: ParseError on installation, Python 3.3
---------------------------+-----------------------------------
Reporter: Julian_O | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Comment (by Julian_O):
That it is "fixed" (i.e. no longer relevant in 0.9) seems a sufficient
solution to me.
I would endorse closing this without no action, leaving the bug-report as
an artifact for other people who stumble on the same problem.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2863#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-11 15:28:01
|
#2863: ParseError on installation, Python 3.3
---------------------------+-----------------------------------
Reporter: Julian_O | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Changes (by zzzeek):
* status_field: awaiting triage => in queue
* component: (none) => ext
* severity: no triage selected yet => trivial - <10 minutes
* milestone: => 0.8.xx
Comment:
its the 2to3 process, and it's only a docstring. SQLAlchemy 9 no longer
uses 2to3 in any case so this issue is already fixed going forward. I
don't think people are generally too concerned about a few error messages
in the 2to3 process, as if the error was truly a fatal one then the
library would fail to import. that said feel free to send a short pullreq
on the 0.8 branch here https://github.com/zzzeek/sqlalchemy/tree/rel_0_8
to expedite resolution of this issue. (will backport to 0.7 where it
likely exists also...)
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2863#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|