sqlalchemy-tickets Mailing List for SQLAlchemy (Page 81)
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-26 12:23:00
|
#2809: Strange effect with association proxy and event listener
----------------------+-----------------------------------------
Reporter: schlamar | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: (none) | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
----------------------+-----------------------------------------
I'm getting this strange traceback in a proprietary codebase.
`job.programs` is an association proxy to `job.job_programs`.
`set_max_stat_program_added` is an event handler listening on
`job.job_programs.append`.
Unfortunately I'm not able to reproduce this issue with a simple test
case. But it looks to me that the flush in the event callback is emitting
a wrong SQL statement related to the association proxy. I can further
investigate and debug this issue if someone gives me instructions but I'm
not allowed to publish the code.
A workaround for this issue is to preload `job.pallets` with `joinedload`
in the query.
{{{
Traceback (most recent call last):
File "tests\test_resources.py", line 251, in test_check_enable
job_res.update(job_id, {'programs': [prog_id], 'enabled': True})
File "mes\resource.py", line 185, in update
job.programs.append(prog)
File "packages\sqlalchemy\ext\associationproxy.py", line 568, in append
self.col.append(item)
File "packages\sqlalchemy\orm\collections.py", line 1057, in append
item = __set(self, item, _sa_initiator)
File "packages\sqlalchemy\orm\collections.py", line 1029, in __set
item = getattr(executor, 'fire_append_event')(item, _sa_initiator)
File "packages\sqlalchemy\orm\collections.py", line 733, in
fire_append_event
item, initiator)
File "packages\sqlalchemy\orm\attributes.py", line 910, in
fire_append_event
value = fn(state, value, initiator or self)
File "packages\sqlalchemy\orm\events.py", line 1496, in wrap
orig_fn(target, value, *arg)
File "mes\model.py", line 81, in set_max_stat_program_added
for pallet in job.pallets:
File "packages\sqlalchemy\orm\attributes.py", line 316, in __get__
return self.impl.get(instance_state(instance), dict_)
File "packages\sqlalchemy\orm\attributes.py", line 613, in get
value = self.callable_(state, passive)
File "packages\sqlalchemy\orm\strategies.py", line 524, in
_load_for_state
return self._emit_lazyload(session, state, ident_key, passive)
File "packages\sqlalchemy\orm\strategies.py", line 585, in
_emit_lazyload
result = q.all()
File "packages\sqlalchemy\orm\query.py", line 2237, in all
return list(self)
File "packages\sqlalchemy\orm\query.py", line 2348, in __iter__
self.session._autoflush()
File "packages\sqlalchemy\orm\session.py", line 1139, in _autoflush
self.flush()
File "packages\sqlalchemy\orm\session.py", line 1818, in flush
self._flush(objects)
File "packages\sqlalchemy\orm\session.py", line 1936, in _flush
transaction.rollback(_capture_exception=True)
File "packages\sqlalchemy\util\langhelpers.py", line 58, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "packages\sqlalchemy\orm\session.py", line 1900, in _flush
flush_context.execute()
File "packages\sqlalchemy\orm\unitofwork.py", line 372, in execute
rec.execute(self)
File "packages\sqlalchemy\orm\unitofwork.py", line 525, in execute
uow
File "packages\sqlalchemy\orm\persistence.py", line 64, in save_obj
table, insert)
File "packages\sqlalchemy\orm\persistence.py", line 569, in
_emit_insert_statements
execute(statement, params)
File "packages\sqlalchemy\engine\base.py", line 662, in execute
params)
File "packages\sqlalchemy\engine\base.py", line 761, in
_execute_clauseelement
compiled_sql, distilled_params
File "packages\sqlalchemy\engine\base.py", line 874, in _execute_context
context)
File "packages\sqlalchemy\engine\base.py", line 1024, in
_handle_dbapi_exception
exc_info
File "packages\sqlalchemy\util\compat.py", line 195, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "packages\sqlalchemy\engine\base.py", line 867, in _execute_context
context)
File "packages\sqlalchemy\engine\default.py", line 324, in do_execute
cursor.execute(statement, parameters)
IntegrityError: (IntegrityError) job_programs.job_id may not be NULL
u'INSERT INTO job_programs (program_id) VALUES (?)'
(1,)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2809>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-26 08:06:41
|
#2808: AssociationProxy should use keywords on create
-----------------------------------+----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: reopened
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Comment (by schlamar):
Plus, your example (with creator) doesn't work because !UserKeyword is not
yet defined for the User class. So you would have to refactor the complete
example to make it work (which could be really messy if you have to use
this solution in production code).
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:11>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-26 07:57:06
|
#2808: AssociationProxy should use keywords on create
-----------------------------------+----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: reopened
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Comment (by schlamar):
I think this is rather a workaround than a solution in case of an
association object because it is really unintuitive.
From a user point of view the "association proxy" pattern shouldn't be
this complex. Essentially you say: proxy this attribute as a collection
via a many-to-many mapping. When a user pass an object to this collection,
SQLAlchemy should know how to build the many-to-many relationship without
requiring manual configuration from the user.
So IMO the creation process in case of an association object should behave
something like this (with !User/Keyword example)
{{{
#!python
def _create(keyword):
# create association object (UserKeyword)
# do not pass the value
uk = self.creator()
# automatically find out how Keyword is related with
# UserKeyword and set the correct attribute
uk.find_relationship_and_set(keyword)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:10>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-26 07:27:18
|
#2808: AssociationProxy should use keywords on create
-----------------------------------+----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: reopened
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by schlamar):
* status: closed => reopened
* resolution: worksforme =>
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:9>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-25 18:24:42
|
#867: document post_update, version_id_col
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: task | Status: closed
Priority: medium | Milestone: 0.x.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:
versioning is documented:
d6ce68727f8ad4c77cc64ac6bbc5fc1 master
be594493e6a6af39e2b5512f3 0.8
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/867#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-25 18:24:37
|
#2793: support server default for version_id_col
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: very major - up to 2 days
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+---------------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: major - 1-3 hours => very major - up to 2 days
* status_field: needs tests => completed/closed
Comment:
rd6ce68727f8ad4c77cc64ac6bbc5f
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2793#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-25 16:11:24
|
#2802: docs fix - orm internals, should be 'attrs' not 'attr'
-----------------------------------+-----------------------------------
Reporter: jonathan | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: documentation | Severity: trivial - <10 minutes
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: no triage selected yet => trivial - <10 minutes
* status_field: awaiting triage => completed/closed
Comment:
b9bd6ffd43a138f0b8964ca master
9fa0088d438c0abed6027 0.8
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2802#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-22 15:13:55
|
#2808: AssociationProxy should use keywords on create
-----------------------------------+----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an hour
Resolution: worksforme | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => worksforme
* status_field: needs questions answered => completed/closed
Comment:
I'm going to close this for now but feel free to reopen if you have
further issues with the current system.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:8>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-22 15:12:54
|
#2808: AssociationProxy should use keywords on create
-------------------------------------------+-------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an
Resolution: | hour
Progress State: needs questions answered | Keywords:
-------------------------------------------+-------------------------------
Comment (by zzzeek):
docs and examples for "creator" are at
http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/associationproxy.html
#creation-of-new-values .
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:7>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-22 15:11:28
|
#2808: AssociationProxy should use keywords on create
-------------------------------------------+-------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an
Resolution: | hour
Progress State: needs questions answered | Keywords:
-------------------------------------------+-------------------------------
Comment (by zzzeek):
that's what "creator" is for:
{{{
#!python
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
name = Column(String(64))
keywords = association_proxy('user_keywords', 'keyword',
creator=lambda v: UserKeyword(keyword=v))
}}}
this can be generalized with your preferred style:
{{{
#!python
def my_association_proxy(src, target):
def create(value):
target_cls = prox.target_class
return target_cls(**{target: value})
prox = association_proxy(src, target, creator=create)
return prox
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
name = Column(String(64))
keywords = my_association_proxy('user_keywords', 'keyword')
}}}
it should be apparent why we can't just change
`_AssociationList._create()` here.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:6>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-22 08:08:06
|
#2808: AssociationProxy should use keywords on create
-------------------------------------------+-------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an
Resolution: | hour
Progress State: needs questions answered | Keywords:
-------------------------------------------+-------------------------------
Comment (by schlamar):
Testcase:
{{{
#!python
from sqlalchemy import Column, Integer, ForeignKey, String
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
name = Column(String(64))
keywords = association_proxy('user_keywords', 'keyword')
class UserKeyword(Base):
__tablename__ = 'user_keyword'
user_id = Column(Integer, ForeignKey('user.id'), primary_key=True)
keyword_id = Column(Integer, ForeignKey('keyword.id'),
primary_key=True)
# bidirectional attribute/collection of "user"/"user_keywords"
user = relationship(User, backref=backref("user_keywords",
cascade="all, delete-orphan"))
# reference to the "Keyword" object
keyword = relationship("Keyword")
class Keyword(Base):
__tablename__ = 'keyword'
id = Column(Integer, primary_key=True)
keyword = Column(String(64))
user = User(name='log')
for kw in (Keyword(keyword='new_from_blammo'),
Keyword(keyword='its_big')):
user.keywords.append(kw)
}}}
Error:
{{{
$ python sqla_2808.py
Traceback (most recent call last):
File "sqla_2808.py", line 39, in <module>
user.keywords.append(kw)
File
"D:\Projekte\HACS\hacs\packages\sqlalchemy\ext\associationproxy.py", line
567, in append
item = self._create(value)
File
"D:\Projekte\HACS\hacs\packages\sqlalchemy\ext\associationproxy.py", line
494, in _create
return self.creator(value)
TypeError: __init__() takes exactly 1 argument (2 given)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-21 22:50:24
|
#2133: convert trac faq section into documentation sections
-----------------------------------+-------------------------------
Reporter: zzzeek | Owner: empty
Type: task | Status: closed
Priority: high | Milestone: 0.x.xx
Component: documentation | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: very major - up to 2 days => major - 1-3 hours
* status_field: in progress => completed/closed
Comment:
r09b93477d26e8298c255b98eb0d6371839bbfa87 0.8
r4268ea06b3efe116361157fa2ad15 master
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2133#comment:8>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-21 15:12:45
|
#2808: AssociationProxy should use keywords on create
-------------------------------------------+-------------------------------
Reporter: schlamar | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: minor - half an
Resolution: | hour
Progress State: needs questions answered | Keywords:
-------------------------------------------+-------------------------------
Changes (by zzzeek):
* type: defect => enhancement
* severity: trivial - <10 minutes => minor - half an hour
* status_field: awaiting triage => needs questions answered
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-21 15:12:20
|
#2808: AssociationProxy should use keywords on create
----------------------------------+-----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+-----------------------------------
Comment (by zzzeek):
particularly, why can't you use the "creator" argument? I'm not
following.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-21 15:06:44
|
#2808: AssociationProxy should use keywords on create
----------------------------------+-----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+-----------------------------------
Comment (by zzzeek):
can you send a usage example please, also all new features go to master
first and are backported to 0.8 as necessary.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-21 11:42:39
|
#2808: AssociationProxy should use keywords on create
----------------------------------+-----------------------------------
Reporter: schlamar | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+-----------------------------------
Changes (by schlamar):
* cc: marc.schlaich@… (added)
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-21 11:42:29
|
#2808: AssociationProxy should use keywords on create
----------------------+----------------------------------------
Reporter: schlamar | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.8.xx
Component: ext | Severity: trivial - <10 minutes
Keywords: | Progress State: awaiting triage
----------------------+----------------------------------------
I want to use the Association Object pattern as described in the docs
(http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/associationproxy.html
#simplifying-association-objects). But I do not want to explicitly write a
constructor and rely on the new "every attribute can be passed as kwarg"
style.
This is currently broken with associationproxy, because it passes the
proxied value directly to the constructor. So if the Association Object
has no explicit constructor, the code fails:
{{{
Traceback (most recent call last):
File "d:\Projekte\HACS\tests\test_model.py", line 12, in test_prog_order
job.programs.append(j1)
File
"d:\Projekte\HACS\hacs\packages\sqlalchemy\ext\associationproxy.py", line
567, in append
item = self._create(value)
File
"d:\Projekte\HACS\hacs\packages\sqlalchemy\ext\associationproxy.py", line
494, in _create
return self.creator(value)
TypeError: __init__() takes exactly 1 argument (2 given)
}}}
Fix for me was to patch `_AssociationList._create` with the following, but
maybe I'm missing something.
{{{
def _create(self, value):
return self.creator(**{self.parent.value_attr: value})
}}}
If it looks good to you, I'll send a PR on GitHub to the 0.8 branch.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2808>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-20 17:30:30
|
#2807: incorrect logic in collection setitem for slice
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.7.xx
Component: orm | 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:
r4bcd7e38e12ca2a74de1644b7d260497a64bc7dd 0.7
r36de3538c10427a74470b54428f952263262e7af 0.8
rb13a434f6fb2a947b284f589148aa8cb6974e3d5 master
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2807#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-20 17:29:58
|
#2807: incorrect logic in collection setitem for slice
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.7.xx
Component: orm | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+----------------------------------
Changes (by zzzeek):
* status_field: on hold => needs tests
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2807#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-20 14:27:02
|
#2807: incorrect logic in collection setitem for slice
--------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.7.xx
Component: orm | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: on hold |
--------------------------+----------------------------------
Comment (by zzzeek):
note the above ternary isn't good for 0.7 since it still supports py2.4.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2807#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-20 14:26:31
|
#2807: incorrect logic in collection setitem for slice
---------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.7.xx
Component: orm | Severity: minor - half an hour
Keywords: | Progress State: on hold
---------------------+---------------------------------------
{{{
diff --git a/lib/sqlalchemy/orm/collections.py
b/lib/sqlalchemy/orm/collections.py
index f8f4b95..54a79f7 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -1075,7 +1075,7 @@ def _list_decorators():
start = index.start or 0
if start < 0:
start += len(self)
- stop = index.stop or len(self)
+ stop = index.stop if index.stop is not None else
len(self)
if stop < 0:
stop += len(self)
}}}
current test case, only occurs on py3k. for some reason py2k isn't taking
us there (maybe the zeroes?):
{{{
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)
bs = relationship("B")
class B(Base):
__tablename__ = 'b'
id = Column(Integer, primary_key=True)
a_id = Column(Integer, ForeignKey('a.id'))
a1 = A()
b1, b2 = B(), B()
a1.bs = [b2]
a1.bs[0:0] = [b1]
assert a1.bs == [b1, b2]
}}}
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2807>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-19 21:50:53
|
#2806: setup.py misbehaves with respect to the location of shared objects
-----------------------------------+------------------------------------
Reporter: assarbad | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Resolution: wontfix | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Comment (by assarbad):
Replying to [comment:4 dstufft]:
> You probably want the --root option. It would not surprise me if
setuptools gets confused by PYTHONHOME.
Thanks, that is exactly it. Feels a bit awkward to say `--root /`, but it
does the job. Thanks again for the help.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2806#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-19 21:37:28
|
#2806: setup.py misbehaves with respect to the location of shared objects
-----------------------------------+------------------------------------
Reporter: assarbad | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Resolution: wontfix | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Comment (by dstufft):
You probably want the --root option. It would not surprise me if
setuptools gets confused by PYTHONHOME.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2806#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-19 19:26:35
|
#2806: setup.py misbehaves with respect to the location of shared objects
-----------------------------------+------------------------------------
Reporter: assarbad | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Resolution: wontfix | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Comment (by zzzeek):
The only function we call setup.py is setup(). There are no options to
control where .so files go or how to respond to $PYTHONHOME, chroot
environments or anything else like that (See
http://docs.python.org/2/distutils/apiref.html#distutils.core.setup for
core setup() and http://pythonhosted.org/distribute/setuptools.html#new-
and-changed-setup-keywords for those added by setuptools). We are
calling it in the identical form as other more widely used packages such
as psycopg2, giving it a list of ext_modules, that's all it accepts.
If setup() is doing the wrong thing based on your environment, I'd assume
the issue is with setuptools. I have no knowledge of what $PYTHONHOME
even does in terms of setuptools, and based on my experience I'd guess it
does not what you expect - $PYTHONHOME is not a variable that is commonly
used these days, standard practice is to use virtualenv for local Python
installations. So from all indications this certainly seems like a usage
issue with setuptools overall and the folks on disutils-sig should have
definitive information on how setuptools works - I'm only a user of it.
If people with knowledge of setuptools can point to an actual bug in
SQLAlchemy's code, reopen this ticket and we will fix it.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2806#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-08-19 18:30:46
|
#2806: setup.py misbehaves with respect to the location of shared objects
-----------------------------------+------------------------------------
Reporter: assarbad | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Resolution: wontfix | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Comment (by assarbad):
Hi hi. Thanks for reading over it. I'm aware that you use `setuptools`. I
am using the same for an extension (albeit proprietary) which I authored
and I can tell you that this behavior cannot solely explained by
`setuptools`.
My extension - by the way with the exact same environment - installs just
fine. I'll see whether I can devise a change to `setup.py` to fix this.
Would you be willing to take this in or not at all? You closed this pretty
quickly, so I'm asking.
Thanks for SQLAlchemy, by the way.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2806#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|