sqlalchemy-tickets Mailing List for SQLAlchemy (Page 85)
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-07-31 16:48:01
|
#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):
No, it had been said that at some point someone tried Cython, and the
performance hit was unacceptable. The question was whether the performance
hit mentioned above was equally unacceptable.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:24>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:46: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):
Whats the question? how long does 10M iterations of int_to_bool take on
my system? how would that be of use without something to compare it to on
the identical system ?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:23>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:43:57
|
#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):
Ehm... without an answer to the above?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:22>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:34:21
|
#2706: add "permanent=True" flag to session.close()
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.8.xx
Component: orm | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in queue |
------------------------------+----------------------------------
Comment (by zzzeek):
this shoudl be a session config setting:
session(close_permanent=True)
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2706#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:33:08
|
#2769: preliminary date operation support
------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.xx
Component: sql | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
------------------------------+-------------------------------
Changes (by zzzeek):
* milestone: 0.9.0 => 0.9.xx
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2769#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:32:39
|
#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 |
-----------------------------------+---------------------------------------
Changes (by zzzeek):
* milestone: 0.9.0 => blue sky
Comment:
this issue seems to be dead for now, tabling out to blue sky.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:21>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:04:54
|
#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
Keywords: | Progress State: in queue
-------------------------+------------------------------------
{{{
#!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()
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2793>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 14:38:34
|
#2792: settable polymorphic identity
-------------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Keywords: | Progress State: awaiting triage
-------------------------+------------------------------------
this would need to be a new feature
{{{
#!python
# -*- coding: utf-8 -*-
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
DYNAMIC = True
#DYNAMIC = False
Base = declarative_base()
_rank_table = Table('rank', Base.metadata,
Column('id', Integer, primary_key=True),
Column('label', String)
)
_taxon_table = Table('taxon', Base.metadata,
Column('id', Integer, primary_key=True),
Column('refno', String),
Column('rank_id', Integer),
ForeignKeyConstraint(['rank_id'], ['rank.id'])
)
_taxon_relationship_table = Table('taxon_relationship', Base.metadata,
Column('taxon_id', Integer, primary_key=True),
Column('referenced_taxon_id', Integer, primary_key=True),
ForeignKeyConstraint(['taxon_id'], ['taxon.id']),
ForeignKeyConstraint(['referenced_taxon_id'], ['taxon.id']),
)
class Rank(Base):
__table__ = _rank_table
class Taxon(Base):
__table__ = _taxon_table
__mapper_args__ = {
'polymorphic_on': 'rank_id',
}
rank = relationship('Rank',
innerjoin=True,
backref=backref('taxa'))
class Family(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483640,
}
class Genus(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483636,
}
class Species(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483630,
}
class Subspecies(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483629,
}
class Variety(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483628,
}
# else:
# __mapper_args__ = {
# 'polymorphic_identity':"BOGUS",
# }
class Form(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483626,
}
class Cultivar(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483624,
}
class Group(Taxon):
if not DYNAMIC:
__mapper_args__ = {
'polymorphic_identity':-2147483623,
}
#else:
# __mapper_args__ = {
# 'polymorphic_identity':"BOGUS",
# }
class TaxonRelationship(Base):
__table__ = _taxon_relationship_table
taxon = relationship('Taxon',
innerjoin=True,
primaryjoin='Taxon.id==TaxonRelationship.taxon_id',
backref=backref('relationships',
cascade='all, delete-orphan',
passive_deletes=True))
referenced_taxon = relationship('Taxon',
innerjoin=True,
primaryjoin='Taxon.id==TaxonRelationship.referenced_taxon_id',
backref=backref('referenced_relationships'))
def _set_polymorphic_identity(subclass, identity):
# http://stackoverflow.com/questions/15112340/how-can-i-set-
polymorphic-identity-after-a-class-is-defined
mapper = class_mapper(subclass)
if not DYNAMIC:
assert mapper.polymorphic_identity == identity
assert mapper.polymorphic_map is
mapper.base_mapper.polymorphic_map
assert mapper.polymorphic_map[identity] is mapper
else:
mapper.polymorphic_identity = identity
# ugly...
mapper.polymorphic_map[identity] = mapper
# then very ugly.
mapper._identity_class = mapper.inherits._identity_class
def initialize_polymorphic_identity(session):
data = {"family": -2147483640,
"genus": -2147483636,
"species": -2147483630,
"subspecies": -2147483629,
"variety": -2147483628,
"form": -2147483626,
"cultivar": -2147483624,
"group": -2147483623}
session.add_all([
Rank(id=v, label=k) for k, v in data.items()
])
ranks = session.query(Rank).all()
def get_rank_id(label):
found_rank = None
for rank in ranks:
if rank.label == label:
found_rank = rank
break
if not found_rank:
raise Exception("No rank with label '" + label + "' has been
found!")
return found_rank.id
def set_rank_identity(subclass, label):
_set_polymorphic_identity(subclass, get_rank_id(label))
set_rank_identity(Family, 'family')
set_rank_identity(Genus, 'genus')
set_rank_identity(Species, 'species')
set_rank_identity(Subspecies, 'subspecies')
set_rank_identity(Variety, 'variety')
set_rank_identity(Form, 'form')
set_rank_identity(Cultivar, 'cultivar')
set_rank_identity(Group, 'group')
# Initialization
engine = create_engine('postgresql://scott:tiger@localhost/test',
echo=True)
Base.metadata.drop_all(engine)
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
# Initialization polymorphic_identity
initialize_polymorphic_identity(session)
t1, t2 = Family(refno='t1'), Cultivar(refno='t2')
tr = TaxonRelationship(taxon=t1, referenced_taxon=t2)
session.add(tr)
session.commit()
t1.refno, t2.refno, tr.taxon_id
print "----------------"
print tr.referenced_taxon
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2792>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-30 16:10:13
|
#2791: Update MySQL reserved words list for 5.5/5.6
---------------------------+-----------------------------------
Reporter: hannosch | Owner:
Type: defect | Status: new
Priority: medium | Milestone: 0.7.xx
Component: mysql | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Changes (by zzzeek):
* priority: low => medium
* milestone: => 0.7.xx
* type: enhancement => defect
* severity: no triage selected yet => trivial - <10 minutes
* status_field: awaiting triage => in queue
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2791#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-30 16:09:21
|
#2791: Update MySQL reserved words list for 5.5/5.6
----------------------------------+------------------------------------
Reporter: hannosch | Owner:
Type: enhancement | Status: new
Priority: low | Milestone:
Component: mysql | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by zzzeek):
a github or bitbucket pull request would be really helpful here.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2791#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-30 15:52:59
|
#2791: Update MySQL reserved words list for 5.5/5.6
-------------------------+-----------------------------------------
Reporter: hannosch | Owner:
Type: enhancement | Status: new
Priority: low | Milestone:
Component: mysql | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-------------------------+-----------------------------------------
The reserved_words set for MySQL was last updated for MySQL 5.1, but 5.5
and 5.6 have added new words. The new reserved words are:
5.5 (http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-
reference-reservedwords-5-5.html):
{{{
'general',
'ignore_server_ids',
'master_heartbeat_period',
'maxvalue',
'resignal',
'signal',
'slow',
}}}
5.6 (http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-
reference-reservedwords-5-6.html):
{{{
'get',
'io_after_gtids',
'io_before_gtids',
'master_bind',
'one_shot',
'partition',
'sql_after_gtids',
'sql_before_gtids',
}}}
I came across this while trying to create a column called 'signal' in an
ORM snippet like:
{{{
class CellMeasure(_Model):
...
signal = Column(SmallInteger)
}}}
This was while using PyMySQL==0.5 and the error was:
{{{
ProgrammingError: (ProgrammingError) (1064, u"You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'signal SMALLINT, ...
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2791>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-29 19:35:04
|
#2469: ORA-24816 error - Incorrect bind parameter order for CLOB update using
Oracle dialect?
-----------------------------------+----------------------------------
Reporter: bmacauley | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: oracle | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Comment (by vvladymyrov):
Sure there is a way to localize and reproduce.
I'll try to write such test and will add it to sqlalchemy.
Would love to do this myself as practice exercise.
Will keep you posted.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2469#comment:12>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-29 17:54:51
|
#2469: ORA-24816 error - Incorrect bind parameter order for CLOB update using
Oracle dialect?
-----------------------------------+----------------------------------
Reporter: bmacauley | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: oracle | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* status_field: needs questions answered => completed/closed
* resolution: => fixed
* severity: no triage selected yet => minor - half an hour
* milestone: 0.x.xx => 0.8.xx
Comment:
hooray ! you wouldn't happen to have a self-contained way to reproduce ?
would love to add a test.
otherwise thanks for commenting!
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2469#comment:11>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-29 17:49:53
|
#2469: ORA-24816 error - Incorrect bind parameter order for CLOB update using
Oracle dialect?
-------------------------------------------+-------------------------------
Reporter: bmacauley | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.x.xx
Component: oracle | Severity: no triage
Resolution: | selected yet
Progress State: needs questions answered | Keywords:
-------------------------------------------+-------------------------------
Comment (by vvladymyrov):
Just wanted to confirm that the fix works for me.
Faced same Oracle exception recently:
"(DatabaseError) ORA-24816: Expanded non LONG bind data supplied after
actual LONG or LOB column"
Updated SQLAlchemy from 0.7.2 to 0.7.10 and tested again - same insert
query worked fine and LONG value was inserted into the table.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2469#comment:10>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-27 21:06:43
|
#2790: sqlite join rewriting fails on columns that assign alternate .key
-----------------------------------+-------------------------------
Reporter: rgg | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | 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 progress => completed/closed
Comment:
this was a major regression, thanks for reporting it. tests are more
solid as a result.
rd64b09b15c703d7e10093181897682
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2790#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-27 20:40:56
|
#2790: sqlite join rewriting fails on columns that assign alternate .key
------------------------------+-------------------------------
Reporter: rgg | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in progress |
------------------------------+-------------------------------
Description changed by zzzeek:
Old description:
> Here's a simple test, however something is also going on with an aliased
> version which only appears during the mechanics used by joinedload, need
> to isolate that:
>
> {{{
> #!python
> from sqlalchemy import *
> from sqlalchemy.orm import *
>
> metadata = MetaData()
>
> a = Table('a', metadata,
> Column('id', Integer, primary_key=True, key='aid'),
> )
>
> b = Table('b', metadata,
> Column('id', Integer, primary_key=True, key='bid'),
> )
> c = Table('c', metadata,
> Column('aid', Integer, ForeignKey('a.aid'), key='aid'),
> Column('bid', Integer, ForeignKey('b.bid'), key='bid'),
> )
>
> from sqlalchemy.dialects import sqlite
>
> s1 = select([a, b], use_labels=True).select_from(a.join(c.join(b)))
>
> print s1.compile(dialect=sqlite.dialect())
>
> }}}
New description:
Here's a simple test, however something is also going on with an aliased
version which only appears during the mechanics used by joinedload, need
to isolate that:
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
metadata = MetaData()
a = Table('a', metadata,
Column('id', Integer, primary_key=True, key='aid'),
)
b = Table('b', metadata,
Column('id', Integer, primary_key=True, key='bid'),
)
c = Table('c', metadata,
Column('aid', Integer, ForeignKey('a.aid')),
Column('bid', Integer, ForeignKey('b.bid')),
)
from sqlalchemy.dialects import sqlite
s1 = select([a, b], use_labels=True).select_from(a.join(c.join(b)))
print s1.compile(dialect=sqlite.dialect())
ca = c.alias()
ba = b.alias()
j = ca.join(ba)
# with aliases, need to list out the column w the key
s1 = select([a, ba.c.bid], use_labels=True).select_from(a.join(j))
print s1.compile(dialect=sqlite.dialect())
}}}
--
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2790#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-27 19:52:32
|
#2790: sqlite join rewriting fails on columns that assign alternate .key
------------------------------+-------------------------------
Reporter: rgg | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in progress |
------------------------------+-------------------------------
Comment (by zzzeek):
OK well here's the issue:
{{{
#!diff
diff --git a/lib/sqlalchemy/sql/compiler.py
b/lib/sqlalchemy/sql/compiler.py
index a5f545d..e535247 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1162,7 +1162,7 @@ class SQLCompiler(engine.Compiled):
use_labels=True).alias()
for c in selectable.c:
- c._label = c._key_label = c.name
+ c._label = c._key_label = c.key
translate_dict = dict(
zip(right.element.c, selectable.c)
)
}}}
want to figure out that eager version though
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2790#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-27 19:40:18
|
#2790: sqlite join rewriting fails on columns that assign alternate .key
------------------------------+-------------------------------
Reporter: rgg | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in progress |
------------------------------+-------------------------------
Changes (by zzzeek):
* priority: medium => highest
* status_field: awaiting triage => in progress
* severity: no triage selected yet => major - 1-3 hours
Old description:
> In SQLite, when we use a secondary table to establish a relationship
> between two objects, the eagerload of this relationship fails.
>
> I've tested it in PostgreSQL and the same code is OK.
>
> Attached to the ticket is a small example of the failure. I've tested it
> with the latest GitHub trunk release.
>
> Kind regards,
>
> Raul Garcia
New description:
Here's a simple test, however something is also going on with an aliased
version which only appears during the mechanics used by joinedload, need
to isolate that:
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
metadata = MetaData()
a = Table('a', metadata,
Column('id', Integer, primary_key=True, key='aid'),
)
b = Table('b', metadata,
Column('id', Integer, primary_key=True, key='bid'),
)
c = Table('c', metadata,
Column('aid', Integer, ForeignKey('a.aid'), key='aid'),
Column('bid', Integer, ForeignKey('b.bid'), key='bid'),
)
from sqlalchemy.dialects import sqlite
s1 = select([a, b], use_labels=True).select_from(a.join(c.join(b)))
print s1.compile(dialect=sqlite.dialect())
}}}
--
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2790#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-27 17:56:23
|
#2790: eagerload fails on SQLite on a N:N relationship
--------------------+-----------------------------------------
Reporter: rgg | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
--------------------+-----------------------------------------
In SQLite, when we use a secondary table to establish a relationship
between two objects, the eagerload of this relationship fails.
I've tested it in PostgreSQL and the same code is OK.
Attached to the ticket is a small example of the failure. I've tested it
with the latest GitHub trunk release.
Kind regards,
Raul Garcia
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2790>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-27 01:00:12
|
#2161: Py3k support for the C extension
-----------------------------------+-------------------------------
Reporter: ged | Owner: pjenvey
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.9.0
Component: cextensions | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: new => closed
* milestone: 0.9.xx => 0.9.0
* resolution: => fixed
* status_field: needs review => completed/closed
Comment:
it's all in, with some more porting of more recent code, seems to work.
thanks all for the help !
ra6adc0a53ebfeeea23ec
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2161#comment:25>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-26 23:16:57
|
#2555: cascading polymorphic ons
------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.xx
Component: orm | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: in queue |
------------------------------+---------------------------------------
Changes (by zzzeek):
* milestone: 0.9.0 => 0.9.xx
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2555#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-26 18:30:43
|
#2268: implement removal for SQLAlchemy events
-----------------------------------+--------------------------------------
Reporter: guest | Owner: zzzeek
Type: task | Status: closed
Priority: medium | Milestone: 0.9.0
Component: engine | Severity: refactor - over two days
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Description changed by zzzeek:
Old description:
> r4505425a38b079a8e2a59f
New description:
--
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2268#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-26 18:26:00
|
#2268: implement removal for SQLAlchemy events
-----------------------------------+--------------------------------------
Reporter: guest | Owner: zzzeek
Type: task | Status: closed
Priority: medium | Milestone: 0.9.0
Component: engine | Severity: refactor - over two days
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Changes (by zzzeek):
* status: new => closed
* severity: very major - up to 2 days => refactor - over two days
* resolution: => fixed
* status_field: in queue => completed/closed
Old description:
New description:
r4505425a38b079a8e2a59f
--
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2268#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-26 04:02:33
|
#2789: possible approach to the "append/set/clear/remove" attribute event issue
-----------------------------------+-------------------------------
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: not decided upon => completed/closed
Comment:
I made much more of a change here, including coming up with a more
informative event token without sacrificing performance, and also moving
all the "halt event" logic into backref handlers, where it can be managed
more effectively and also should save on method call overhead. r550141b.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2789#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-07-25 22:48:33
|
#2789: possible approach to the "append/set/clear/remove" attribute event issue
--------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Keywords: | Progress State: not decided upon
--------------------+------------------------------------
{{{
#!diff
diff --git a/lib/sqlalchemy/orm/attributes.py
b/lib/sqlalchemy/orm/attributes.py
index 13c2cf2..166a467 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -960,8 +960,6 @@ class CollectionAttributeImpl(AttributeImpl):
collection.append_with_event(value, initiator)
def remove(self, state, dict_, value, initiator,
passive=PASSIVE_OFF):
- if initiator and initiator.parent_token is self.parent_token:
- return
collection = self.get_collection(state, state.dict,
passive=passive)
if collection is PASSIVE_NO_RESULT:
diff --git a/lib/sqlalchemy/orm/collections.py
b/lib/sqlalchemy/orm/collections.py
index 03917d1..a48369d 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -666,7 +666,6 @@ class CollectionAdapter(object):
def append_with_event(self, item, initiator=None):
"""Add an entity to the collection, firing mutation events."""
-
getattr(self._data(), '_sa_appender')(item,
_sa_initiator=initiator)
def append_without_event(self, item):
diff --git a/test/orm/test_attributes.py b/test/orm/test_attributes.py
index 4bcecb7..539dff1 100644
--- a/test/orm/test_attributes.py
+++ b/test/orm/test_attributes.py
@@ -1167,7 +1167,7 @@ class BackrefTest(fixtures.ORMTest):
# one level deep. without the parent_token,
# it keeps going until a ValueError is raised
# and this condition changes.
- assert c1 in p1.children
+ assert c1 not in p1.children
class CyclicBackrefAssertionTest(fixtures.TestBase):
"""test that infinite recursion due to incorrect backref assignments
diff --git a/test/orm/test_backref_mutations.py
b/test/orm/test_backref_mutations.py
index 925eedf..74accf5 100644
--- a/test/orm/test_backref_mutations.py
+++ b/test/orm/test_backref_mutations.py
@@ -78,7 +78,7 @@ class O2MCollectionTest(_fixtures.FixtureTest):
# doesn't extend to the previous collection tho,
# which was already loaded.
# flushing at this point means its anyone's guess.
- assert a1 in u1.addresses
+ assert a1 not in u1.addresses
assert a1 in u2.addresses
def test_collection_move_notloaded(self):
@@ -699,9 +699,7 @@ class O2MStaleBackrefTest(_fixtures.FixtureTest):
u1.addresses.append(a1)
u2.addresses.append(a1)
- # events haven't updated
- # u1.addresses here.
- u1.addresses.remove(a1)
+ assert a1 not in u1.addresses
assert a1.user is u2
assert a1 in u2.addresses
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2789>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|