[sqlalchemy] Strange deferred loading behavior...

2007-11-01 Thread Bruza
I am quite baffled by the "deferred loading" behavior on a class member in the following code (see below). Looks like if I create an object (t1) with some field (c2) having None as value, then after I save, commit, and closed the object in a SQLAlchemy session, I cannot update the c2 field. It wil

[sqlalchemy] Re: like with mapper in tg?

2007-11-01 Thread iain duncan
On Thu, 2007-01-11 at 15:13 -0400, Michael Bayer wrote: > for now, Resource.query.filter(resource_table.c.somecol.op('rlike') > ()) will work. Thanks. Going through the SA0.4 tutorial, it seems this would be easier if I abandon rlike and just go with like, which ( thinking about it ) will be jus

[sqlalchemy] Re: Foreign key error

2007-11-01 Thread Michael Bayer
On Nov 1, 2007, at 6:41 PM, Mike Orr wrote: > > I have two tables Incident and Entry with a 1:many relationship. > Incident.orr_id is a primary key. Entry.entry_id is a primary key, > and Entry.orr_id is a foreign key. (The column names are a legacy > tradition.) I have the following model an

[sqlalchemy] Re: Foreign key error

2007-11-01 Thread Rick Morrison
Autoloading and foreign key detection are problematic on some DB engines (I think SQlite falls in this category as it doesn't directly support FKs), on other engines they are simply hard to detect. I would think that your override of the FK in the t_incident table should be all that's needed to pi

[sqlalchemy] Foreign key error

2007-11-01 Thread Mike Orr
I have two tables Incident and Entry with a 1:many relationship. Incident.orr_id is a primary key. Entry.entry_id is a primary key, and Entry.orr_id is a foreign key. (The column names are a legacy tradition.) I have the following model and classes: t_incident = Table("Incident", meta, aut

[sqlalchemy] Re: rlike with assign_mapper?

2007-11-01 Thread Michael Bayer
for now, Resource.query.filter(resource_table.c.somecol.op('rlike') ()) will work. On Nov 1, 2007, at 2:12 PM, iain duncan wrote: > > Others gave some pointers a while back on using rlike with query > filters. I'm wondering whether there is some way to get rlike with > assign_mapper syntax? >

[sqlalchemy] Re: rlike with assign_mapper?

2007-11-01 Thread Ants Aasma
To do this nicely ticket #767 would have to be fixed, but until then this should work: def rlike_match_all(entity, **kwargs): return and_(*[getattr(entity, key).comparator.expression_element().op('rlike')(value) for key,value in kwargs.items()]) and use it by Resource.select(rlike_match_all(R

[sqlalchemy] Re: adding an object through association_proxy

2007-11-01 Thread Matt
I think I misunderstood the use of the association proxy -- I don't think I want to use it in this case anymore... thx m On Oct 31, 6:33 pm, Matt <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a table (Content) which relates to itself via a many-to-many > relationship through a link table (Con

[sqlalchemy] Re: assign_mapper and order_by?

2007-11-01 Thread Michael Bayer
On Nov 1, 2007, at 12:41 PM, Lukasz Szybalski wrote: > > Hello, > Does assign_mapper have any order_by function available to him after > the object has been mapped? > > model.py - > myclass_table = sqlalchemy.Table('myClass', metadata, autoload=True) > > class myClass(object): > pass > >

[sqlalchemy] rlike with assign_mapper?

2007-11-01 Thread iain duncan
Others gave some pointers a while back on using rlike with query filters. I'm wondering whether there is some way to get rlike with assign_mapper syntax? I'm using right now Resource.select_by( **query_dict ) where query dict is name/val pairs, I'd like to be able to make those name/val pairs b

[sqlalchemy] assign_mapper and order_by?

2007-11-01 Thread Lukasz Szybalski
Hello, Does assign_mapper have any order_by function available to him after the object has been mapped? model.py - myclass_table = sqlalchemy.Table('myClass', metadata, autoload=True) class myClass(object): pass myclassmapper=assign_mapper(session.context,myClass,myclass_table) control

[sqlalchemy] Re: Add arbitrary information to some classes

2007-11-01 Thread Michael Bayer
sorry, i havent been following. two++ dicts ?! this is getting out of hand. if we have to have any dicts at all, it would be just one dict. and also, it should be proxied through a property so that if you dont access it, its never even created. we have this on ConnectionFairy right n

[sqlalchemy] Re: sqlalchemy.exceptions.SQLError: (OperationalError) database is locked

2007-11-01 Thread Michael Bayer
1st step would be to ensure youre on the latest version of sqlite. second step would be to create a test program illustrating the behavior using pysqlite only (sqlalchemy doesn't have anything to do with sqlite lock timeout issues). if you can confirm that the timeout isnt working in tha

[sqlalchemy] Re: Add arbitrary information to some classes

2007-11-01 Thread Rick Morrison
That sounds reasonable to me; my knee-jerk thought was that we might need to worry about memory usage, but these references are only on low-count instances like tables, columns, sessions and mappers, not ORM object instances. On 10/31/07, Paul Johnston <[EMAIL PROTECTED]> wrote: > > Hi, > > Ah s

[sqlalchemy] sqlalchemy.exceptions.SQLError: (OperationalError) database is locked

2007-11-01 Thread Matthew Newhook
I posted this message in the pylons group but as of yet have received no response. http://groups.google.com/group/pylons-discuss/browse_frm/thread/093ec04b48e49c3c?hl=en# I've been looking into this problem a little more. From my reading of the SQLite documentation there should be a 5 second tim