sqlalchemy-tickets Mailing List for SQLAlchemy (Page 84)
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-08-03 00:40:54
|
#2794: CircularDependencyError with jython because WeakSequence doesn't preserve
order
---------------------------+-----------------------------------
Reporter: sayap | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.8.xx
Component: utils | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Comment (by sayap):
Yeah. It looks like because an integer always hashes to itself, a dict in
cpython with keys in sequential integers (and inserted in the same order)
will always have its ordering "preserved".
Meanwhile, in the Javaland, while an integer still hashes to itself, a Map
would perform another hash function to determine the final hash key, so
the ordering become rather random.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2794#comment:6>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-02 21:49:06
|
#2720: use Cython for C extensions?
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by zzzeek):
current pypy 2.1 *doubles* the speed of the test script, which I've
updated in r7f9becf3fbbdb33d2 to have heavy writing and reading, with a
50% improvement, whereas current C extensions only improve it about 6%.
see https://gist.github.com/zzzeek/6143700.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:34>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-02 17:53:25
|
#2794: CircularDependencyError with jython because WeakSequence doesn't preserve
order
---------------------------+-----------------------------------
Reporter: sayap | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.8.xx
Component: utils | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Comment (by zzzeek):
strange i can't get WeakSequence to naturally return the wrong ordering on
cpython or pypy even with large lists, makes me wonder if
WeakValueDictionary is somehow preserving insert ordering on those
platforms.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2794#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-02 17:36:57
|
#2794: CircularDependencyError with jython because WeakSequence doesn't preserve
order
---------------------------+-----------------------------------
Reporter: sayap | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.8.xx
Component: utils | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Changes (by zzzeek):
* priority: medium => highest
* milestone: => 0.8.xx
* severity: no triage selected yet => trivial - <10 minutes
* status_field: awaiting triage => in queue
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2794#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-02 17:35:25
|
#2794: CircularDependencyError with jython because WeakSequence doesn't preserve
order
----------------------------------+------------------------------------
Reporter: sayap | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: utils | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by zzzeek):
OK great, yeah if I do this and run tests with --reversetop:
{{{
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py
index ae1ca20..1d2d30d 100644
--- a/lib/sqlalchemy/orm/util.py
+++ b/lib/sqlalchemy/orm/util.py
@@ -1327,3 +1327,11 @@ def randomize_unitofwork():
from sqlalchemy.testing.util import RandomSet
topological.set = unitofwork.set = session.set = mapper.set = \
dependency.set = RandomSet
+ from sqlalchemy.util import WeakSequence
+ import random
+ def _random_iter(self):
+ l = self._storage.values()
+ random.shuffle(l)
+ return iter(l)
+ WeakSequence.__iter__ = _random_iter
+
}}}
crazy failures. very weird that one isn't hitting in pypy.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2794#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-02 15:58:13
|
#2794: CircularDependencyError with jython because WeakSequence doesn't preserve
order
----------------------------------+------------------------------------
Reporter: sayap | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: utils | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by sayap):
Here's some sample code that causes `CircularDependencyError` with Jython
2.7b1+ (current hg tip 7eb5574d023d):
{{{
from sqlalchemy.engine import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.types import Integer, String
url = 'postgresql+zxjdbc://postgres@localhost/test'
engine = create_engine(url)
Session = scoped_session(sessionmaker())
Session.configure(bind=engine)
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
discriminator = Column(String(10))
__mapper_args__ = {
'polymorphic_on': discriminator,
'polymorphic_identity': 'a',
}
class B(A):
__tablename__ = 'b'
__mapper_args__ = {
'polymorphic_identity': 'b',
}
id = Column(Integer, ForeignKey(A.id), primary_key=True)
class C(B):
__tablename__ = 'c'
__mapper_args__ = {
'polymorphic_identity': 'c',
}
id = Column(Integer, ForeignKey(B.id), primary_key=True)
Base.metadata.create_all(engine)
c = C()
Session.add(c)
Session.flush()
}}}
In this case, the random ordering would cause
`Mapper.self_and_descendants()` to return C first instead of A,
subsequently causing `table_to_mapper` to have table A -> mapper C, which
then causes the circular dependency.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2794#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-02 12:48:45
|
#2794: CircularDependencyError with jython because WeakSequence doesn't preserve
order
----------------------------------+------------------------------------
Reporter: sayap | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: utils | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by zzzeek):
can you give me some hint of a clue as to a stack trace, test case,
something illustrating what particular operation/where has this issue ?
thanks.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2794#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-02 10:18:48
|
#2794: CircularDependencyError with jython because WeakSequence doesn't preserve
order
--------------------+-----------------------------------------
Reporter: sayap | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: utils | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
--------------------+-----------------------------------------
I am toying with Jython, and the same app that works fine with CPython
somehow throws a `CircularDependencyError` when trying to insert an
instance of a mapped class that participates in a joined table
inheritance.
I trace down the culprit to be `WeakSequence.__iter__()`, which doesn't
preserve the insertion order.
Changing the line from:
{{{
# 0.8
return self._storage.itervalues()
}}}
or:
{{{
# 0.9
return iter(self._storage.values())
}}}
to:
{{{
for idx in sorted(self._storage):
yield self._storage[idx]
}}}
make things work again on Jython.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2794>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-01 01:09:38
|
#2791: Update MySQL reserved words list for 5.5/5.6
-----------------------------------+-----------------------------------
Reporter: hannosch | Owner:
Type: defect | Status: closed
Priority: medium | Milestone: 0.7.xx
Component: mysql | Severity: trivial - <10 minutes
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in queue => completed/closed
Comment:
rd28d9f2bc85a479a8a9ec600ea6003c441323887 0.7
r8aa5631107287e5b34cf2e50d2672fbc8063a1b4 0.8
r25839c064d995b3664f0cef01768961ac5e4807f master
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2791#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 23:10:06
|
#2777: update class-level mapper event docs
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: documentation | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in queue => completed/closed
Comment:
r312764983b909977534aae52058af754d9ea3d04 rel_0_8
rc6fdfeed00e25988115254ee5ea8c05253bdbd9f master
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2777#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 22:51:22
|
#2783: rendering of aliased CTE
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.7.xx
Component: sql | 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:
r83b5939e2047208b44341e5cb2a67803bd274d0b 0.7
r834d18ca0430f1d706906a7ab0899322d9e72f00 0.8
r8b0f4d2a92c54cde9fefa8182bbd1bb503071d4 master
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2783#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 22:50:43
|
#2783: rendering of aliased CTE
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.7.xx
Component: sql | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+----------------------------------
Changes (by zzzeek):
* milestone: 0.8.xx => 0.7.xx
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2783#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 21:47:43
|
#2720: use Cython for C extensions?
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by zzzeek):
it's not terrible, it's like typesafe python. if you want to branch
somewhere and update setup.py to use cython for pyx files I can try
building it.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:33>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 21:18:46
|
#2720: use Cython for C extensions?
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by claudiofreire):
I attached the WIP cprocessors (proc.pyx) so you get an idea of how it
looks like
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:32>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 21:07:56
|
#2720: use Cython for C extensions?
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by zzzeek):
OK, I was curious at least what some of the code would look like, I'm
leaving it open as something to look into down the road, depending on
future need. The complaints we get about speed right now are limited
mostly to folks trying to insert millions of rows with the ORM.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:31>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 21:03:30
|
#2720: new C extensions for attribute accessing
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by claudiofreire):
Alright, close then.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:30>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 20:49:56
|
#2720: new C extensions for attribute accessing
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by zzzeek):
Unfortunately I can't give you a guarantee that I'll accept a patch which
rewrites all the C extensions in Cython. I'd need to see it, need to see
in a bigger sense how the performance differences are (testing one or two
functions in isolation is not that informative), need to understand how it
works, how to maintain it, what kinds of build/installation issues are
going to be introduced, where it might re-introduce mistakes that have
been fixed in the existing C exts (relatively unlikely) or where it
introduces all new mistakes (very likely). I'm curious to see how
they'd look but as I'm not the one playing with Cython right now I don't
have too clear of a view how much code we'd introduce and how well it
runs.
Overall I'm not too enthused about a rewrite of the C exts at this point
because we've got many years of stability with the current ones, they at
least don't have any dependencies, and adding many more if any seems like
a wasted effort - Pypy is a funded project going full steam ahead on
making such C extensions unnecessary, and they are very interested most
specifically in optimizing for the Django and SQLAlchemy projects.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:29>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 20:37:57
|
#2793: support server default for version_id_col
------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+-------------------------------
Comment (by zzzeek):
diff:@master:ticket_2793
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2793#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 20:36:43
|
#2793: support server default for version_id_col
------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | 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/2793#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 20:36:33
|
#2793: support server default for version_id_col
------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
------------------------------+-------------------------------
Description changed by zzzeek:
Old description:
> {{{
> #!diff
> diff --git a/lib/sqlalchemy/orm/persistence.py
> b/lib/sqlalchemy/orm/persistence.py
> index 46b0be9..6013095 100644
> --- a/lib/sqlalchemy/orm/persistence.py
> +++ b/lib/sqlalchemy/orm/persistence.py
> @@ -248,7 +248,9 @@ def _collect_insert_commands(base_mapper,
> uowtransaction, table,
> has_all_pks = True
> for col in mapper._cols_by_table[table]:
> if col is mapper.version_id_col:
> - params[col.key] = mapper.version_id_generator(None)
> + val = mapper.version_id_generator(None)
> + if val is not None:
> + params[col.key] = val
> else:
> # pull straight from the dict for
> # pending objects
> @@ -315,19 +317,21 @@ def _collect_update_commands(base_mapper,
> uowtransaction,
> params[col.key] = history.added[0]
> hasdata = True
> else:
> - params[col.key] = mapper.version_id_generator(
> + val = mapper.version_id_generator(
> params[col._label])
> -
> - # HACK: check for history, in case the
> - # history is only
> - # in a different table than the one
> - # where the version_id_col is.
> - for prop in mapper._columntoproperty.itervalues():
> - history = attributes.get_state_history(
> - state, prop.key,
> - attributes.PASSIVE_NO_INITIALIZE)
> - if history.added:
> - hasdata = True
> + if val is not None:
> + params[col.key] = val
> +
> + # HACK: check for history, in case the
> + # history is only
> + # in a different table than the one
> + # where the version_id_col is.
> + for prop in
> mapper._columntoproperty.itervalues():
> + history = attributes.get_state_history(
> + state, prop.key,
> + attributes.PASSIVE_NO_INITIALIZE)
> + if history.added:
> + hasdata = True
> else:
> prop = mapper._columntoproperty[col]
> history = attributes.get_state_history(
> }}}
>
> {{{
> #!python
> from sqlalchemy import *
> from sqlalchemy.orm import *
> from sqlalchemy.ext.declarative import declarative_base
>
> Base = declarative_base()
>
> class A(Base):
> __tablename__ = 'a'
>
> id = Column(Integer, primary_key=True)
> data = Column(String)
> version_id = Column('xmin', Integer, server_default=FetchedValue())
>
> __mapper_args__ = {
> "version_id_col": version_id,
> "version_id_generator": lambda val: None
> }
>
> engine = create_engine("postgresql://scott:tiger@localhost/test",
> echo=True)
> Base.metadata.drop_all(engine)
> engine.execute("create table a (id serial primary key, data varchar)")
>
> s = Session(engine)
>
> a1 = A(data='a1')
>
> s.add(a1)
>
> s.flush()
>
> a1.data = 'a2'
>
> s.flush()
> }}}
New description:
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
data = Column(String)
version_id = Column('xmin', Integer,
server_default=FetchedValue(),
server_onupdate=FetchedValue())
__mapper_args__ = {
"version_id_col": version_id,
"version_id_generator": lambda val: None,
# "eager_defaults": True # should not be needed
}
# should work whether or not this is set
# __table_args__ = {"implicit_returning": False}
engine = create_engine("postgresql://scott:tiger@localhost/test",
echo=True)
Base.metadata.drop_all(engine)
engine.execute("create table a (id serial primary key, data varchar)")
s = Session(engine)
a1 = A(data='a1')
s.add(a1)
s.flush()
a1.data = 'a2'
s.flush()
}}}
--
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2793#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 20:35:25
|
#2793: support server default for version_id_col
------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
------------------------------+-------------------------------
Comment (by zzzeek):
a lot more going on in the ticket_2793 branch on this.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2793#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 20:11:35
|
#2720: new C extensions for attribute accessing
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by claudiofreire):
Yes, and I attached a patch that adds a C extension for it, but there was
a (founded) concern that it would be hard to maintain, so I suggested
using Cython. And since having just one extension done in Cython seemed
backwards, it was also suggested to move them all to Cython, for ease of
maintenance.
So I started with cprocessors, and noting there was a (slight) performance
decrease, I wasn't sure whether to proceed.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:28>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 20:01:27
|
#2720: new C extensions for attribute accessing
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by ged):
Replying to [comment:20 claudiofreire]:
> So, I finally got back to this. Pyrex has no Py3 support, so Cython's
the only choice.
>
> cprocessors.int_to_bool becomes a tad slower, going from 0.84s (py2) to
0.94s (py3) for 10M iterations. Is that in line with your previous
results?
>
> The same code with cython and py2 stays at 0.84s, so I'm wondering if
the slowness is a py3 thing instead of a cython thing.
IIRC, the offender(s) (ie too slow) was not in the type processors, but
rather in the rowproxy special methods (__getitem__ and possibly getattr).
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:27>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:58:46
|
#2720: new C extensions for attribute accessing
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by claudiofreire):
The savings are in the avoidance of creating and initializing python
frames, which is the main source of function call overhead in python. Any
function call in python will initialize a frame, some will also create one
(there's a free list to avoid that), so that's why it cannot be done in
python.
Attribute access in python is very very fast, so the overhead of
initializing a frame for such access is noticeable.
The caching is there only as a tool to prevent calling python code (which,
again, pays the full cost of initializing a frame, no matter how fast that
function is inside).
I could find no way to achieve that in pure python. Usually, I use
operator.attrgetter to create fast attribute-getting functions, but this
descriptor does a little bit more than just accessing the attribute, so
that's not viable here.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:26>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:52:26
|
#2720: new C extensions for attribute accessing
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by zzzeek):
its not a big deal. but also re: the attribute access thing, if the
speed savings are just that it caches the getting of various attributes,
why can't that be done in pure Python?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:25>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|