Hello all,
I've been playing a bit with polymorphic concrete inheritance, and
noticed that when you have several levels of polymorphic loading (ie
my child class is also a parent class which I want to load
polymorphically), the query for the top-level class includes the child
polymorphic join
hm i had not run my tests for quite a while.. this seems recent thing.
lets see if i can dig anything of help... nothing much, one side
works, another not at all.
one of my set of inheritance tests (direct over sa, A-B) is ok.
the other one (over dbcook) fails completely, even for A-B
On Tue, 2 Dec 2008 at 23:21, Faheem Mitha wrote:
Yes, I was looking for this, and printed out obj.__dict__ but didn't
see it there. A dictionary of attributes is very useful in theory, but
doesn't always seem to have all attributes. Is this documented
anywhere?
Try dir(obj). You'll see it
um yeah, actually this behavior is affecting all multi-level usage of
polymorphic_union. So, while polymorphic_union is quite obviously
(since nobody has noticed this pretty glaring issue) on the decline in
the 0.5 series, this is quite severe and ill try to have a look at it
today.
On
On Wed, Dec 3, 2008 at 15:03, Michael Bayer [EMAIL PROTECTED] wrote:
um yeah, actually this behavior is affecting all multi-level usage of
polymorphic_union. So, while polymorphic_union is quite obviously
(since nobody has noticed this pretty glaring issue) on the decline in
the 0.5
this ones big, i can handle it. the attached patch makes your case
work, but the problem represented here still makes itself apparent in
other ways and I havent strength tested this patch. you might want
to see if this patch works in all of your test cases.
Hi
i tried the following example, but i cant get the join to work:
CREATE TABLE product (
idINTEGER,
price NUMERIC(15,2) NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE i18n_product (
id INTEGER,
lang VARCHAR(2),
On Wed, Dec 3, 2008 at 16:04, Michael Bayer [EMAIL PROTECTED] wrote:
this ones big, i can handle it. the attached patch makes your case
work, but the problem represented here still makes itself apparent in
other ways and I havent strength tested this patch. you might want
to see if this
I've met so few other Farrells, maybe we ARE related!! Get it, related,
in a SqlAlchemy group. Oh man I'm such a geek!!
-Original Message-
From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Bob
Sent: Tuesday, December 02, 2008 9:00 AM
To:
Hi there,
is there any canonical way of removing all SQAlchemy instrumentation
from a mapped object?
I'm trying to feed a complex mapped class instance through PyAMF
(which serializes objects to be read in Adobe Flash). This works fine
for scalar attributes but not for collections, e.g. a
it needed some more work. the final version of this fix is in r5412.
On Dec 3, 2008, at 10:49 AM, Gaetan de Menten wrote:
On Wed, Dec 3, 2008 at 16:04, Michael Bayer
[EMAIL PROTECTED] wrote:
this ones big, i can handle it. the attached patch makes your case
work, but the problem
On 3 Dez., 18:32, Michael Bayer [EMAIL PROTECTED] wrote:
I would also posit that PyAMF's behavior might be inappropriate in
this case. InstrumentedList is a subclass of list so I don't
immediately see why it would treat it differently.
Upon further inspection, this was exactly the case.
We've created a new branch and are in the process of migrating all of
our documentation over to Sphinx. The process has gone well and we
have a working demo of the full system online. By converting to
Sphinx, we get the huge advantage of being on a standardized platform
that everyone
That would be
desc = session.query(I18Product).filter_by(id=1183, lang=en).one()
The Problem with your query is that you query() for Product, not for
I18NProduct, so regardless of and filter and join functions you
specify, you will always receice Product objects. Think of query
(Product) as a
Hello,
is there a way with the ORM layer to have abstract base class like in
django ?
http://docs.djangoproject.com/en/dev/topics/db/models/#abstract-base-
classes
Another somehow related question is there any plan for declarative
base to support inheritance ala django ?
Regards,
Guillaume
On Wed, 3 Dec 2008 08:58:42 -0500 (EST), [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
On Tue, 2 Dec 2008 at 23:21, Faheem Mitha wrote:
Yes, I was looking for this, and printed out obj.__dict__ but didn't
see it there. A dictionary of attributes is very useful in theory, but
doesn't always seem
On Dec 3, 2008, at 1:26 PM, Guillaume wrote:
Hello,
is there a way with the ORM layer to have abstract base class like in
django ?
http://docs.djangoproject.com/en/dev/topics/db/models/#abstract-base-
classes
sure, just pass along cls=MyBaseClass along to declarative_base().
You can
this is still there:
File sqlalchemy/orm/mapper.py, line 168, in __init__
self.with_polymorphic[1] = self.with_polymorphic[1].alias()
TypeError: 'tuple' object does not support item assignment
also, related question: once there is A-B-C, concrete, how u'd get
some A by id?
and maybe related:
def query_by_id( klas, idname, oid, .):
q = session.query( klas).filter_by( **{idname: oid})
# filter by atype for concrete
m = class_mapper( klas)
concrete = bool( m.with_polymorphic[1] )
if concrete: q= q.filter( m.polymorphic_on ==
thats strange, i dont suppose you could send me how you're setting up
that polymorphic union
On Dec 3, 2008, at 3:05 PM, [EMAIL PROTECTED] wrote:
and maybe related:
def query_by_id( klas, idname, oid, .):
q = session.query( klas).filter_by( **{idname: oid})
# filter by atype
can i... maybe something like
table_A = Table( 'A', meta,
Column( 'name', String(length=200, ), ),
Column( 'db_id', primary_key= True, type_= Integer, ),
)
table_B = Table( 'B', meta,
Column( 'dataB', String(length=200 ),
this is still there:
File sqlalchemy/orm/mapper.py, line 168, in __init__
self.with_polymorphic[1] = self.with_polymorphic[1].alias()
TypeError: 'tuple' object does not support item assignment
try mapping to something that is already an alias() (this would
lend insight into your
I wrote it on usage reciepts, but no one answered yet.
The reason I'm doing so, is to solve the following problem: I have an
object that is compounded from the fields - obj_id, num1, num2, num3.
obj_id is my primary key. I want to create a save method for the
object's class, that will do the
so u'd get two objects sharing same dict, and changin one will break
the other, in a hideous way.
better copy stuff one by one, or invent some other way.
On Wednesday 03 December 2008 22:47:34 [EMAIL PROTECTED] wrote:
I wrote it on usage reciepts, but no one answered yet.
The reason I'm
SQLAlchemy instruments classes using an event-based system that
intercepts all setattribute and collection mutation operations, and
logs these events as things to be reconciled when the Session is
flushed. Additionally, the __dict__ of the object itself is
referenced by the
On Dec 3, 2008, at 3:45 PM, [EMAIL PROTECTED] wrote:
okay, then i get this as answer to my other question - so concrete
polymorhism relations/get()/identity on top of it are blue_sky.
that's okay - just put a line about it in the docs.
dbcook is throwing warnings about it since long time.
On Wednesday 03 December 2008 23:28:01 Michael Bayer wrote:
On Dec 3, 2008, at 3:45 PM, [EMAIL PROTECTED] wrote:
okay, then i get this as answer to my other question - so
concrete polymorhism relations/get()/identity on top of it are
blue_sky. that's okay - just put a line about it in the
On Dec 3, 2008, at 5:15 PM, [EMAIL PROTECTED] wrote:
On Wednesday 03 December 2008 23:28:01 Michael Bayer wrote:
On Dec 3, 2008, at 3:45 PM, [EMAIL PROTECTED] wrote:
okay, then i get this as answer to my other question - so
concrete polymorhism relations/get()/identity on top of it are
A. Thanks for this great idea. From your suggestion, I realize that if
I am going to use the new method, than I must enforce my __new__ (and
__init__)
to get all the unique fields as arguments. Then, if the object already
exists in the db to return it, and otherwise save the new object.
An
On Dec 3, 2008, at 6:39 PM, [EMAIL PROTECTED] wrote:
B. So I can settle with a merge() method that returns an object. I
think it's the only solution (beside forcing them to work with saving
to the db). Actually, it's not too bad. But it's also not easy, I tell
you, to write such a
30 matches
Mail list logo