sqlalchemy-tickets Mailing List for SQLAlchemy (Page 56)
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...> - 2014-02-11 11:55:38
|
#2954: This point is similar in nature to the previous one. When people begin to
exercise and don't see results overnight, they become discouraged and fail
to follow their exercise routine as rigidly as they should. So, they may
follow a programme for 3 weeks, have a week off, feel bad, then try again
and exercise for 3 more weeks, have a week off, and so on...
---------------------------------+-----------------------------------------
Reporter: abbieella | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Keywords: GARCINIA CAMBOGIA | Progress State: awaiting triage
PRO |
---------------------------------+-----------------------------------------
Hi guys, this article has been taken from our inside Incite Me NOW
promulgation. It briefly goes over the top pentad reasons why people break
to gather their fitness goals.
Without advance ado, lets statesman the countdown turn with circumscribe
5...
5. A Need OF Athlete ADVICE GARCINIA CAMBOGIA PRO
Most group don't person a honour in sports science, or see an innovative
certificate in Private Upbringing. Any soul exclusive meet started effort.
So, during the 'I'm a conceiver' platform, people are deed to require few
organise of substance so they can exertion aright. Most, however, have
this fantastic slight object called 'experience', which holds them bet and
stops them getting the advice and instruction they poorness.
Nonetheless, when you transmute a consumer of Squires Condition, you
faculty score attain to an skilled Personal Trainer to ask any ask your
nerve desires and to put you unwaveringly on the traveling to success.
4. Shy KNOWLEDGE OF NUTRITION
A soul can be sweat 3 nowadays a hebdomad and putting in 110% sweat during
their workouts, but they soothe don't see any genuine results. This is
because they port't purloined their fast into benignity. Your fast is AS
Grave to stretch your fitness goals as sweat is.
Again, with Squires Soundness, you bed gain to a squad of Fast and
Nutrition Advisors who instrument escort and discuss you on how to tweak
your fasting to deal your goals, and ensure that you do get the results
you poorness.
3. EXPECTATIONS ARE SET TOO Piercing
When I no. stepped into a gym, old 19, I quick became discouraged after
performing sit ups 3 present a period for several weeks, but I hadn't
achieved six hike abs as I mentation I would... At that mend, the towel
was tangled in. I momently resign my function until I learnt what was
actually likely and determined what was indispensable in say to attain six
compress abs. I also learnt to win my expectations; my initial
expectations were conscionable too superior.
Most fill are also equal this, they preparation for a few weeks, realise
they haven't got the beach embody they thought they would, and end up
quitting. Leadership wasn't stacked in a day... And your saint embody gift
belike know a lowercase human to attain than you initially unsurprising -
BUT IT IS VERY Executable AND Rattling Realizable.
Over a 12 period stop (which is the time of your Squires Shape Workout
Announcement) you can expect to retrograde between 12-20lbs (if your
content is weight release) or add an additional 12-18lbs of incline yobbo
(if you are search to figure tough).
What you require to execute is researchable, it upright may demand a
immature somebody to get there than you initially prospective.
2. A Need OF Property GARCINIA CAMBOGIA PRO
This amount is connatural in nature to the preceding one. When fill solon
to grooming and don't see results overnight, they transmute discouraged
and neglect to choose their read software as stiffly as they should. So,
they may obey a performance for 3 weeks, feature a week off, find bad,
then try again and employ for 3 statesman weeks, someone a period off, and
so on...
In prescribe to struggle this, a workout information staleness be followed
to the text. Uniformity is the key when effort towards your nonsuch body.
Try to bury that you are disagreeable to get turn, or physique rowdy (or
whatsoever your goal). The results testament grow; you retributory
pauperism to conform on shadowing the performance we somebody provided for
you.
And eventually...The merchandise one ground why grouping Disappoint to
have there shape goals is...
1. Nonstarter TO DEFINE Suitable GOALS AT THE OUTSET...
Yup, the product one intellect for people imperfection to gain their
fitness goals is imperfection to delineate correct goals at the outset.
http://garciniacambogiaproreviews.com/
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2954>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
#2953: speak to the staff. Propose that you happen to be taking into consideration
a number of other gyms at the same time and find out what type of offer
they can current you with correct absent.
---------------------------------+-----------------------------------------
Reporter: vanezapow | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Keywords: Raspberry Ultra | Progress State: awaiting triage
Ketone |
---------------------------------+-----------------------------------------
Wellspring existence and eudaemonia and condition could be the most
epochal privilege in a someone's macrocosm these life. Every day corporal
take is a must suchlike puffing is and today you'll be fit to settle on to
control out from business or employ the really superfine individual
manager to support you along with your routines. There are umteen workouts
and workout routines similar aerobics, yoga and with a panoptic limit of
shape workouts travel a broader activity of health and fitness components.
Raspberry Ultra Ketone
Individuals spend usurious amounts of money on gym memberships and workout
equipments for the correct workout programme, so why go ballistic and
destroy finances author than what is not requisite. So no concern whether
you workout from residence or you instrument be an exterior eudaemonia and
condition enthusiast, finance region the reserve condition accessories can
not just piddle operate out competent but in increase service it beautify
fun and consoling.
Here can be a tape from the most determinative shape equipment you are
competent to buy on-line or at your close fitness centrist adapt
distributer. These things are much or lower essential for all kinds of
workout and truly are an ought to bonk.
Pick a Upbeat and condition Order: 10 Guidelines on Determining on an
superior Eudaemonia society
Estimate
If you end on a wellbeing and fitness club on the opposite characteristic
of your municipality, module you be capable to check pleased and play an
try to pay a travel to often? Nearly sure not. Especially on those life
whenever your tenaciousness is on a smallest and your fulfil schedule is
recent alive. A superb condition lodge place give sooner be someplace
between your habitation along with your work. Effort a condition
association in the blob is believable to cut indorse your
quantify.
Costs Raspberry Ultra Ketone
Signing up for a eudaimonia and suitability lodge could be a big efficient
promotion. Gym membership costs are not to be stolen softly and so are
usually the key present why men and women decide on a fated fitness heart.
Inexpensive gym subscriptions power seem similar a such meliorate
resolution within the starting, but could be an undermanned choice if
these gyms cannot harmonise your demands. The direct aforementioned
calculate goes for statesman dear soundness gyms. You power be having to
pay a lot of for what you testament be receiving. Moreover, numerous
eudaimonia and shape gyms will birdsong for a standardisation fee. You may
just wait for any particular provide to keep on these fees, but you may
also mouth to the staff. Take that you happen to be dimension and conceive
out what typewrite of act they can underway you with proper missing.
[http://www.raspberryultraketonefacts.com/]
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2953>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-11 00:23:54
|
#2932: textasfrom compatibility with columns, query
-----------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.9.3
Component: sql | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: reopened => closed
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
rbf934018a52b4fe4c43745f is as far as we can go. I tried also doing this:
{{{
#!python
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -274,7 +274,7 @@ class _CompileLabel(visitors.Visitable):
__slots__ = 'element', 'name'
def __init__(self, col, name, alt_names=()):
- self.element = col
+ self.element = self._element = col
self.name = name
self._alt_names = (col,) + alt_names
@@ -511,7 +511,7 @@ class SQLCompiler(Compiled):
add_to_result_map(
labelname,
label.name,
- (label, labelname, ) + label._alt_names,
+ (label, labelname, label._element) +
label._alt_names,
label.type
)
}}}
which allows the idea of `text("select A as
X").columns(column("A").label("X"))`, but we get into naming conflicts
there, and test.sql.test_query's tests for label conflicts does find one.
The issue is if there are multiple columns named "A" with different
labels, we can't do it as above. It's possible we could do something
specific for `TextAsFrom`, but it would have to correct for the same
column() present twice perhaps. I don't think it's a need right now.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2932#comment:8>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 23:02:33
|
#2951: Confusing Query.get() behaviour. Possible insufficient criterion checking.
-----------------------------------+-----------------------------------
Reporter: enomad | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: orm | Severity: trivial - <10 minutes
Resolution: fixed | Keywords: Query get criterion
Progress State: completed/closed |
-----------------------------------+-----------------------------------
Comment (by zzzeek):
a security breach requires that an attacker can inject a specific,
incorrect outcome into code that otherwise performs its function correctly
when this injection is not taking place.
In this case, there is no incorrect result that can be returned; get()
does its job consistently. It's just that a particular exception related
to how get() was used may or may not be raised, and in that sense it
behaves more like a query that is inconsistently available, but not in any
way one that occasionally returns unexpected results versus expected
results. The results it returns, when it's not raising an exception, are
consistent and are not subject to manipulation.
A number is passed to get() - the primary key of an object. That number
is *always* the primary key that will be searched. There is no way for
the query to return the "wrong" result, as far as get() - get() always
returns the object with the pk that you give it, end of story. There is
no attack vector by which an attacker can manipulate input into a system
such that a different object is returned, and especially not a specific,
different object.
An application that writes out session.query(User).filter(User.password ==
somepassword).get(5), is broken. However, while putting that code in
production is a security hazard, the hazard is because the code is
entirely broken 100% of the time, not because it can be manipulated in
some circumstances to return unexpected results. That particular query
will fail every time to check the user's password, which will be revealed
in any test. It's not any different from a query that fails to check the
password at all.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2951#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 22:35:06
|
#2952: "cascading" declared_attr ?
-----------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: high | Milestone: 0.9.xx
Component: declarative | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+-------------------------------
Comment (by zzzeek):
note that I don't like this name too much. It would be nicer if
declared_attr could be the namespace, like:
{{{
@declared_attr(all_subclasses=True)
def id(cls):
...
@declared_attr.all_subclasses # ?
def id(cls):
...
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2952#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 22:34:00
|
#2952: "cascading" declared_attr ?
-------------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: high | Milestone: 0.9.xx
Component: declarative | Severity: major - 1-3 hours
Keywords: | Progress State: not decided upon
-------------------------+------------------------------------
use case:
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base, declared_attr,
cascading_declared_attr
Base = declarative_base()
class HasId(object):
@cascading_declared_attr
def id(cls):
if cls.__name__=='Content':
return Column('id', Integer, primary_key=True)
else:
return Column('id', Integer, ForeignKey('content.id'),
primary_key=True)
class Content(HasId, Base):
content_type = Column(String(20))
@cascading_declared_attr
def __tablename__(cls):
return cls.__name__.lower()
class Project(Content):
currency = Column(String(3))
target = Column(Integer)
current = Column(Integer)
}}}
{{{
#!diff
diff --git a/lib/sqlalchemy/ext/declarative/__init__.py
b/lib/sqlalchemy/ext/declarative/__init__.py
index 0ee4e33..4566324 100644
--- a/lib/sqlalchemy/ext/declarative/__init__.py
+++ b/lib/sqlalchemy/ext/declarative/__init__.py
@@ -1300,7 +1300,7 @@ Mapped instances then make usage of
from .api import declarative_base, synonym_for, comparable_using, \
instrument_declarative, ConcreteBase, AbstractConcreteBase, \
DeclarativeMeta, DeferredReflection, has_inherited_table,\
- declared_attr, as_declarative
+ declared_attr, cascading_declared_attr, as_declarative
__all__ = ['declarative_base', 'synonym_for', 'has_inherited_table',
diff --git a/lib/sqlalchemy/ext/declarative/api.py
b/lib/sqlalchemy/ext/declarative/api.py
index 2418c6e..dc6c42b 100644
--- a/lib/sqlalchemy/ext/declarative/api.py
+++ b/lib/sqlalchemy/ext/declarative/api.py
@@ -162,6 +162,26 @@ class declared_attr(interfaces._MappedAttribute,
property):
def __get__(desc, self, cls):
return desc.fget(cls)
+class cascading_declared_attr(declared_attr):
+ """A :class:`.declared_attr` that will be invoked for all subclasses.
+
+ Use :class:`.cascading_declared_attr` when a particular
``@declared_attr``
+ needs to be invoked individually for each subclass in a hierarchy::
+
+ class HasId(object):
+ @cascading_declared_attr
+ def id(cls):
+ if has_inherited_table(cls):
+ return Column(Integer, ForeignKey("content.id"),
primary_key=True)
+ else:
+ return Column(Integer, primary_key=True)
+
+ class Content(HasId, Base):
+ pass
+
+ class SubContent(Content):
+ pass
+ """
def declarative_base(bind=None, metadata=None, mapper=None, cls=object,
name='Base', constructor=_declarative_constructor,
diff --git a/lib/sqlalchemy/ext/declarative/base.py
b/lib/sqlalchemy/ext/declarative/base.py
index 4fda9c7..a8702cc 100644
--- a/lib/sqlalchemy/ext/declarative/base.py
+++ b/lib/sqlalchemy/ext/declarative/base.py
@@ -31,7 +31,7 @@ def _declared_mapping_info(cls):
def _as_declarative(cls, classname, dict_):
- from .api import declared_attr
+ from .api import declared_attr, cascading_declared_attr
# dict_ will be a dictproxy, which we can't write to, and we need to!
dict_ = dict(dict_)
@@ -96,6 +96,12 @@ def _as_declarative(cls, classname, dict_):
"not applying to subclass %s."
% (base.__name__, name, base, cls))
continue
+ elif isinstance(obj, cascading_declared_attr):
+ ret = obj.__get__(obj, cls)
+ dict_[name] = column_copies[obj] = ret
+ if isinstance(ret, (Column, MapperProperty)) and \
+ ret.doc is None:
+ ret.doc = obj.__doc__
elif base is not cls:
# we're a mixin.
if isinstance(obj, Column):
@@ -125,8 +131,8 @@ def _as_declarative(cls, classname, dict_):
"be declared as @declared_attr callables "
"on declarative mixin classes.")
elif isinstance(obj, declarative_props):
- dict_[name] = ret = \
- column_copies[obj] = getattr(cls, name)
+ ret = getattr(cls, name)
+ dict_[name] = column_copies[obj] = ret
if isinstance(ret, (Column, MapperProperty)) and \
ret.doc is None:
ret.doc = obj.__doc__
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2952>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 21:46:40
|
#2951: Confusing Query.get() behaviour. Possible insufficient criterion checking.
-----------------------------------+-----------------------------------
Reporter: enomad | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: orm | Severity: trivial - <10 minutes
Resolution: fixed | Keywords: Query get criterion
Progress State: completed/closed |
-----------------------------------+-----------------------------------
Comment (by enomad):
>please explain fully why you think this bug is a security breach
It can be security breach... when we want to check ownership of related
item by something like
{{{
item = Item.query.join(User).filter(User == current_user).filter(Item.id
== requested_item).one()
if not item:
raise 404
}}}
and think of get(id) is sugar of filter_by(id=id).one()
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2951#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 21:35:54
|
#2951: Confusing Query.get() behaviour. Possible insufficient criterion checking.
-----------------------------------+-----------------------------------
Reporter: enomad | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: orm | Severity: trivial - <10 minutes
Resolution: fixed | Keywords: Query get criterion
Progress State: completed/closed |
-----------------------------------+-----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
backported to 0.8
r99717570ff085ac2cda16d96155d0b206b5fe713 0.8
r2a25e42c08e7541fa70dfc5e6b1ac843d6d02027 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2951#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 21:22:16
|
#2951: Confusing Query.get() behaviour. Possible insufficient criterion checking.
------------------------------+-----------------------------------
Reporter: enomad | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.8.xx
Component: orm | Severity: trivial - <10 minutes
Resolution: | Keywords: Query get criterion
Progress State: in progress |
------------------------------+-----------------------------------
Changes (by zzzeek):
* priority: medium => high
* status_field: awaiting triage => in progress
* component: cextensions => orm
* severity: no triage selected yet => trivial - <10 minutes
* milestone: => 0.8.xx
Comment:
please explain fully why you think this bug is a security breach. No
illegal value is being injected here, the filter() criterion is being
ignored and you're getting id #2, just as you would if the filter()
criterion hadn't been used. It is of course a bug.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2951#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 21:07:48
|
#2951: Confusing Query.get() behaviour. Possible insufficient criterion checking.
---------------------------------+-----------------------------------------
Reporter: enomad | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Keywords: Query get criterion | Progress State: awaiting triage
---------------------------------+-----------------------------------------
Also I cant find any documentation about that. I think it can be security
breach. Here is the code
https://gist.github.com/stanislav88/8924167
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2951>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-10 05:58:21
|
#2950: abstractconcretebase polish
-------------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.3
Component: declarative | Severity: major - 1-3 hours
Keywords: | Progress State: in queue
-------------------------+------------------------------------
seems to not be putting the class name into declarative registry:
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base,
AbstractConcreteBase
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
class BC(AbstractConcreteBase, Base):
pass
class B(BC):
__tablename__ = 'b'
id = Column(Integer, primary_key=True)
a_id = Column(Integer, ForeignKey('a.id'))
__mapper_args__ = {
"polymorphic_identity": "b",
"concrete": True
}
class C(BC):
__tablename__ = 'c'
id = Column(Integer, primary_key=True)
a_id = Column(Integer, ForeignKey('a.id'))
__mapper_args__ = {
"polymorphic_identity": "c",
"concrete": True
}
# fails
#A.collection = relationship("BC", primaryjoin="BC.a_id == A.id")
# workaround
configure_mappers()
A.collection = relationship(BC, primaryjoin=BC.a_id == A.id)
}}}
check if there's a dupe for this also
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2950>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 21:48:12
|
#2949: event propagation regression
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.9.3
Component: orm | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: major - 1-3 hours => minor - half an hour
* status_field: in progress => completed/closed
Comment:
rab738c21aa540cebf3c2f839e1
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2949#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 21:02:16
|
#2949: event propagation regression
---------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.3
Component: orm | Severity: major - 1-3 hours
Keywords: | Progress State: in progress
---------------------+------------------------------------
{{{
#!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)
class B(A):
pass
from sqlalchemy import event
@event.listens_for(Base, "load", propagate=True) # boom
def load(x, y):
pass
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2949>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 19:26:55
|
#2948: better replacement of columns w bound values on "local" side for lazy load
------------------------------+-------------------------------
Reporter: mkadin | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.3
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in progress |
------------------------------+-------------------------------
Comment (by zzzeek):
hmmm nope, all the way back to 0.6.9 it still renders "FROM persons,
cities WHERE ? = persons.city_id AND cities.deleted_at IS NULL", so this
would be a new behavior.
the new query is:
{{{
SELECT persons.id AS persons_id, persons.name AS persons_name,
persons.deleted_at AS persons_deleted_at, persons.city_id AS
persons_city_id
FROM persons
WHERE ? = persons.city_id AND ? IS NULL
2014-02-09 14:24:18,009 INFO sqlalchemy.engine.base.Engine (1, '2014-02-09
14:24:18.006459')
}}}
so whatever that second "?" is determines what we are comparing to NULL.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2948#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 19:24:04
|
#2948: better replacement of columns w bound values on "local" side for lazy load
------------------------------+-------------------------------
Reporter: mkadin | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.3
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in progress |
------------------------------+-------------------------------
Comment (by zzzeek):
heh, not even, we dont need a warning, it produces option "B":
{{{
#!python
e = create_engine("sqlite://", echo=True)
Base.metadata.create_all(e)
s = Session(e)
s.add(City(people=[Person(), Person()]))
s.commit()
c1 = s.query(City).first()
print c1.people # produces [Person, Person]
c1.deleted_at = datetime.datetime.now()
s.commit()
print c1.people # produces empty list
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2948#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 19:23:20
|
#2820: session.merge/nullable primary keys - FlushError: Can't update table using
NULL for primary key value
-----------------------------------+-------------------------------
Reporter: elsdoerfer | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: orm | Severity: major - 1-3 hours
Resolution: worksforme | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Comment (by elsdoerfer):
A quick post-mortem on this, since I finally had to address it:
- Our pre-SQLAlchemy database had a permission table (user, group,
permission), where a permission would apply to either a user or a group,
and the other column was NULL.
- It used a unique index rather than a primary key.
- SQLAlchemy does not support a table without a primary key.
- I wanted to trick SQLAlchemy by using __mapper_args__ to define a
primary key, but in truth using a unique key in the database, but during
session.merge() you run into the FlushError above when using an instance
with existing permissions relations.
I've now simply removed the foreign keys from the user and group columns,
and am storing an integer 0 for the column that does not apply.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2820#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
#2948: better replacement of columns w bound values on "local" side for lazy load
------------------------------+-------------------------------
Reporter: mkadin | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.3
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in progress |
------------------------------+-------------------------------
Changes (by zzzeek):
* severity: minor - half an hour => major - 1-3 hours
* component: documentation => orm
* priority: medium => high
* milestone: 0.9.xx => 0.9.3
* status_field: in queue => in progress
Comment:
change of plans, sorry.
this can be detected and we can produce a more "correct" condition here,
when we add a rule that all local side columns become bound values
unconditionally. its possible that older versions worked this way, will
need to check.
Sorry, the suggestion that lazyload render a JOIN threw me off here. The
bug is more about replacement of bound parameters.
Patch:
{{{
#!diff
diff --git a/lib/sqlalchemy/orm/relationships.py
b/lib/sqlalchemy/orm/relationships.py
index 62d4d6b..e21f8f4 100644
--- a/lib/sqlalchemy/orm/relationships.py
+++ b/lib/sqlalchemy/orm/relationships.py
@@ -2479,6 +2479,7 @@ class JoinCondition(object):
binds = util.column_dict()
lookup = util.column_dict()
equated_columns = util.column_dict()
+ being_replaced = set()
if reverse_direction and self.secondaryjoin is None:
for l, r in self.local_remote_pairs:
@@ -2486,16 +2487,30 @@ class JoinCondition(object):
_list.append((r, l))
equated_columns[l] = r
else:
+ # replace all "local side" columns, which is
+ # anything that isn't marked "remote"
+ being_replaced.update(self.local_columns)
for l, r in self.local_remote_pairs:
_list = lookup.setdefault(l, [])
_list.append((l, r))
equated_columns[r] = l
def col_to_bind(col):
- if col in lookup:
- for tobind, equated in lookup[col]:
- if equated in binds:
- return None
+ if col in being_replaced or col in lookup:
+ if col in lookup:
+ for tobind, equated in lookup[col]:
+ if equated in binds:
+ return None
+ else:
+ assert not reverse_direction
+ # would like to warn here, but still some cases
+ # where the other column is still table-bound,
+ # so cant quite detect that here.
+ #util.warn(
+ # "Relationship %s creating a fixed condition by
"
+ # "comparing local column %s to a constant; "
+ # "consider revising this primaryjoin for
greater "
+ # "efficiency." % (self.prop, col))
if col not in binds:
binds[col] = sql.bindparam(
None, None, type_=col.type, unique=True)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2948#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 17:53:37
|
#2948: clarify behavior of explicit primaryjoin wrt backref, including importance
of establishing both sides for unusual cases
--------------------------------+----------------------------------
Reporter: mkadin | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.xx
Component: documentation | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in queue |
--------------------------------+----------------------------------
Comment (by mkadin):
That makes sense. I almost wonder if C might be the better choice? If
someone is asking sqlalchemy to do something it isn't sure about how to
do, why not raise an error telling people to use a different primaryjoin?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2948#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
#2948: clarify behavior of explicit primaryjoin wrt backref, including importance
of establishing both sides for unusual cases
--------------------------------+----------------------------------
Reporter: mkadin | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.xx
Component: documentation | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in queue |
--------------------------------+----------------------------------
Changes (by zzzeek):
* component: orm => documentation
* severity: no triage selected yet => minor - half an hour
* status_field: awaiting triage => in queue
* milestone: => 0.9.xx
Comment:
While there is a simple way to make this work in what I think is an
acceptable way, it has to occur on your end (basically, setting a distinct
primaryjoin, which is what you did. Set it to None instead of "", btw.).
I don't think there's a way that SQLAlchemy could be guessing how to
interpret this, and beyond that, lazy loading doesn't generate JOINs.
You can produce lazy loads that have JOINs rendered, but the JOIN would
always have to come from an existing target mapper which is mapped to a
JOIN in some way or a special "secondary" target that refers to a JOIN;
that is, within "produce a lazy load from A to B", no new "JOIN" is
produced that wasn't already defined. The complexity of lazyload having
to decide that a particular primaryjoin implies a JOIN should be created,
when meanwhile it's really not what you want anyway, isn't really worth it
and would make life harder for everyone (surprising, buggy, complicated,
etc., and not even what you want!)
The key pattern behind why this produces bad SQL is because the
relationship of Person.city is specifically omitting a City that has a
"deleted_at" value. So then if we say, "given a City, what is the
collection of People for that City?". OK, if City.deleted_at is None,
this is simple, it is all the People rows with city_id=<city.id>.
But if City.deleted_at is non NULL. Is it: A. all the Person objects
which refer to this City via city_id? B. no Person objects, because City
is deleted? or C. this is an invalid request; for a City with deleted_at
is non NULL, the list of Person objects associated with it is undefined?
It's because the behavior of this backref case is inherently ambiguous
that happens to correspond with SQL that makes no sense either.
We can add documentation clarifying the behavior of primaryjoin when used
in a backref but that's about it here.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2948#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 17:08:35
|
#2948: generated sql when using custom primaryjoin and backref is funky.
--------------------+-----------------------------------------
Reporter: mkadin | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: orm | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
--------------------+-----------------------------------------
Hello,
In searching through some of our slowest queries, we came across some
funky behavior with the sql that is generated with a relationship that
included a custom primaryjoin and a backref. I've attached a script,
running against the latest sqlalchemy from pip, which will reproduce the
issue on a postgres backend; I haven't tried any other DBs.
For a relationship that looks like
{{{
city = relationship('City', primaryjoin='and_(City.id == Person.city_id,
City.deleted_at == None)', backref='people')
}}}
The sql generated for accessing this relationship is fine. However, for
the backref, you would expect the sql to look like
{{{
SELECT persons.id, persons.name, persons.city_id FROM persons
JOIN cities on persons.city_id = cities.id AND cities.deleted at IS NULL
WHERE cities.id = %(some_city_id);
}}}
Though is is strange to have the {{{cities.deleted_at IS NULL}}} in the
join clause, it is still valid sql no? Instead, sqlalchemy gives the
following sql:
{{{
SELECT persons.id AS persons_id, persons.name AS persons_name,
persons.city_id AS persons_city_id
FROM persons, cities
WHERE %(param_1)s = persons.city_id AND cities.deleted_at IS NULL
}}}
This ends up scanning the entire cities table even though no info is
needed.
For now, we've used the backref() function to define a specific
primaryjoin="" for the backref, which is fine, but I thought I'd report
this as a bug as well.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2948>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-09 02:36:46
|
#2947: add many-to-one usage example to ORM tutorial, possibly brief usage
examples to each of basic relational patterns
---------------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.xx
Component: documentation | Severity: major - 1-3 hours
Keywords: | Progress State: in queue
---------------------------+------------------------------------
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2947>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-08 19:04:58
|
#2946: standard_conforming_strings prior to PG 8.2
----------------------------------+-----------------------------------
Reporter: KyleJamesWalker | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.3
Component: postgres | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
----------------------------------+-----------------------------------
Comment (by KyleJamesWalker):
Perfect thanks!
I saw that but the requirements stated SQLAlchemy 0.8, and I need a newer
version of SQLAlchemy as 0.8 failed when trying to connect to postgres 9.3
(and I need to be connected to both DBs in my app right now). I also
looked and saw that it's code was inheriting off of PGDialect_psycopg2, so
it would of had the same problem if it is in fact compatible with 0.9,
without modifications.
Thanks again.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2946#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-08 18:22:58
|
#2946: standard_conforming_strings prior to PG 8.2
----------------------------------+-----------------------------------
Reporter: KyleJamesWalker | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.3
Component: postgres | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
----------------------------------+-----------------------------------
Changes (by zzzeek):
* severity: no triage selected yet => trivial - <10 minutes
* status_field: awaiting triage => in queue
* milestone: => 0.9.3
Comment:
here's a patch, can't commit it bc bitbucket is down:
{{{
#!python
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py
b/lib/sqlalchemy/dialects/postgresql/base.py
index 29584d1..43e77d5 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1567,7 +1567,8 @@ class PGDialect(default.DefaultDialect):
#
http://www.postgresql.org/docs/9.3/static/release-9-2.html#AEN116689
self.supports_smallserial = self.server_version_info >= (9, 2)
- self._backslash_escapes = connection.scalar(
+ self._backslash_escapes = self.server_version_info < (8, 2) or \
+ connection.scalar(
"show standard_conforming_strings"
) == 'off'
}}}
but also, for redshift can you please use:
https://pypi.python.org/pypi/redshift-sqlalchemy
it's listed here in the docs:
http://docs.sqlalchemy.org/en/rel_0_9/dialects/index.html#external-
dialects
redshift is not exactly postgresql in any case so the project there is
maintaining compatibility.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2946#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-08 17:11:53
|
#2946: Redshift support
-----------------------------+-----------------------------------------
Reporter: KyleJamesWalker | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: postgres | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-----------------------------+-----------------------------------------
SQLAlchemy 9.1 does not support connecting to RedShfit because of the
change in dialects/postgresql/base.py:
{{{
class PGDialect(default.DefaultDialect):
...
def initialize(self, connection):
...
self._backslash_escapes = connection.scalar(
"show standard_conforming_strings"
) == 'off'
}}}
This crashes because there is no standard_conforming_string defined in
redshift. I think this check needs to be added "self.server_version_info
>= (8, 2)", as the documentation for postgres starts mentioning this in
8.2.
http://www.postgresql.org/docs/8.2/static/runtime-config-
compatible.html
This was working on older versions of SQLAlchemy but I need to also
connect to a postgres 9.3 db in my app, so I needed to upgrade.
For now I've made a simple work around:
Register the dialect in my app:
{{{
from sqlalchemy.dialects import registry
registry.register("redshift", "myapp.dialects.redshift",
"RedShiftDialect")
}}}
Define a new dialect in my app:
{{{
from sqlalchemy.dialects.postgresql.base import ENUM
from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2
from sqlalchemy import types as sqltypes
class RedShiftDialect(PGDialect_psycopg2):
def initialize(self, connection):
# Don't call super, it will crash, manually copying code that
super would call
#super(PGDialect, self).initialize(connection)
self.implicit_returning = self.server_version_info > (8, 2) and \
self.__dict__.get('implicit_returning', True)
self.supports_native_enum = self.server_version_info >= (8, 3)
if not self.supports_native_enum:
self.colspecs = self.colspecs.copy()
# pop base Enum type
self.colspecs.pop(sqltypes.Enum, None)
# psycopg2, others may have placed ENUM here as well
self.colspecs.pop(ENUM, None)
#
http://www.postgresql.org/docs/9.3/static/release-9-2.html#AEN116689
self.supports_smallserial = self.server_version_info >= (9, 2)
# This breaks redshift, if a version check was here or exception
# protection the RedShiftDialect would not be needed
###Suggest Adding Check: if self.server_version_info >= (8, 2):
###
#self._backslash_escapes = connection.scalar(
# "show standard_conforming_strings"
# ) == 'off'
# Don't call super, it will crash, manually copying code that
super would call
#super(PGDialect_psycopg2, self).initialize(connection)
self._has_native_hstore = self.use_native_hstore and \
self._hstore_oids(connection.connection) is not None
self._has_native_json = self.psycopg2_version >= (2, 5)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2946>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2014-02-08 14:34:05
|
#2945: Increasing the co-pay will provide you lower monthy insurance premiums
though you have to shell out more right now to make up for reduced expense
of the premiums.
-------------------------+-----------------------------------------
Reporter: Emper2977 | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Keywords: LXW PRO T | Progress State: awaiting triage
-------------------------+-----------------------------------------
Quite a few duration the standing of examination contract still sadly
table posessing one. With all the incumbent conveniences and motives that
one can avow himself/herself to confinement off obtaining shelter in
Siouan, he or she is weakness to cite the fact that accidents or health
mending emergencies can occur at any instant. Ergo, it is e'er moral that
one moldiness be healthy to fuck eudaimonia insurance in Chiwere. The
security and reassurance that solely a shelter can utilize is really main.
Spare yourself the articulate and the financial LXW PRO T
attempt of posessing a eudaimonia shelter.
Since there are individual existing laws in Ioway regarding eudaimonia
rectify, it is definitely seeming that health maintenance is
constitutional and everyone staleness operation it. With is content to
undergo mind of the outgoing needs of a reproduction, the protection IA
really seeks to get the soul for all.
Having aid sum is pivotal for you, as it is to get thwarting tending at
the equal example. It is far advisable that you utilise your scrutiny news
by means of this typewrite of want kinda than excruciation from the
unwellness itself. Regulation and treatments for your health is
indispensable to reservation your all articulate health.
Also, the costs of drugs are ever-increasing annually, and exploit the
examination protection coverage that leave palm the costs of medications
is needful. There may be a secondary co-pay for this but that's something
you can already pay for rather than needing to ail yourself with the
accomplished expense.
Remaining benefits of the Sioux scrutiny insurance encompass a
comprehensive news for all your scrutiny needs. It can be expensive or
high-priced but it is designer it. You can prefer the group welfare
contract contract. You can mark up for a unit or club to get this. Or
maybe your workplace can offer this if you truly can't open the scrutiny
contract in Sioux. After all, it has been estimated that around 17% of
Iowans can't see the money for any contract whatsoever.
With any luck, this does not produce you without protection. You can plant
undergo approaches and do predestinate things to effectively pay the
upbeat insurance. Initially, equilibrize your costs by halting habits
specified as vapour. This will allow you to ramification out for shelter.
If you purchased the welfare insurance policy spell as yet breathing, you
requirement to divulge these info to your insurance band so that you can
change your month-to-month payment commerce. LXW PRO T
In plus, whenever researchable, don't secure in intense sports or hobbies.
The Eudaemonia Shelter Lot faculty impose higher prices.
Augmentative the co-pay leave supply you lowly monthy protection premiums
though you hold to exoskeleton out many redress now to kind up for reduced
disbursal of the premiums.
[http://lxwprotreviews.com/]
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2945>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|