[sqlalchemy] Re: begginers query question

2010-08-25 Thread Dobrysmak
Hi. Thanks yor suggestions but it does not work for me. I'm guessing i'm doing something wrong. I've got this two classes (User , Groups) in seperet files, where i've got to put the relation (relationship)? in both files? or just the one with the ForeignKey? Also, is the relationship must be

[sqlalchemy] one to many relation, removing and adding list issue

2010-08-25 Thread Martin-Leon Francois
Hi, I am trying in the same session to detach an instance from a collection ( one to many) flush and commit everything (all is ok) and then attach the removed instance again. unsuccessfully. in below code, last assert fails. I don't understand why I am not able to append m2 to o1.to_many

Re: [sqlalchemy] orm object, before after

2010-08-25 Thread Michael Hipp
On 8/24/2010 9:47 PM, Michael Bayer wrote: Michael Hipp wrote: How do I make a copy of an orm object such that modifications to the copy do not affect the original? x = MyObject() for a in dir(myoldobject): if not a.startswith('_'): setattr(x, a,

[sqlalchemy] Re: TypeDecorator Problem with basic association pattern

2010-08-25 Thread Frank
Hello Michael, that worked well, thank you very much for your aid. I'm just having trouble understanding why I need to do the None check. I thought from my example that weight could'nt be None at all ... could you be so kind to elaborate a bit what's happening behind the scene? When I tested the

Re: [sqlalchemy] Support for CouchDB

2010-08-25 Thread Diez B. Roggisch
On Wednesday, August 25, 2010 12:26:42 Rawlins wrote: Hello Guys, Do we have support for CouchDB with SQlAlchemy? Can't seem to find much information anywhere so I'm guessing not, just thought I would check. The SQL in SQLAlchemy pretty much says it all. The whole way CouchDB and RDBMS

Re: [sqlalchemy] Support for CouchDB

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 6:26 AM, Rawlins wrote: Hello Guys, Do we have support for CouchDB with SQlAlchemy? Can't seem to find much information anywhere so I'm guessing not, just thought I would check. There's a long term plan to allow plugins that would provide attribute instrumentation

Re: [sqlalchemy] Merge(load=False) woes

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 9:37 AM, Nikolaj wrote: Hello, I'm struggling to use the Beaker caching example in my project. Accessing any attribute on an instance from cache triggers a load from database of the instance - even trying to read the primary key! that means the instances that you're

Re: [sqlalchemy] Re: TypeDecorator Problem with basic association pattern

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 9:39 AM, Frank wrote: Hello Michael, that worked well, thank you very much for your aid. I'm just having trouble understanding why I need to do the None check. I thought from my example that weight could'nt be None at all ... could you be so kind to elaborate a bit

Re: [sqlalchemy] Merge(load=False) woes

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 10:47 AM, Michael Bayer wrote: On Aug 25, 2010, at 9:37 AM, Nikolaj wrote: Hello, I'm struggling to use the Beaker caching example in my project. Accessing any attribute on an instance from cache triggers a load from database of the instance - even trying to read

[sqlalchemy] Session.merge and multiple databases

2010-08-25 Thread Raf Geens
Hi, I have a sqlite database A and a MySQL database B which share the same schema, where I want to synchronize the contents of certain tables in A with those in B at certain times. Except for the synchronizing step the contents on A's side don't change, while those on B's side might. I'm trying

Re: [sqlalchemy] Session.merge and multiple databases

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 10:50 AM, Raf Geens wrote: Hi, I have a sqlite database A and a MySQL database B which share the same schema, where I want to synchronize the contents of certain tables in A with those in B at certain times. Except for the synchronizing step the contents on A's side

[sqlalchemy] Re: Support for CouchDB

2010-08-25 Thread Rawlins
Hello Guys, Thanks for the info, i did expect that to be the case! I can understand that the architecture is indeed very different. As an extension to my question then, which DBMS would you guys recommend for stability. We have a small embedded platform which has an unreliable power source.

[sqlalchemy] Re: Merge(load=False) woes

2010-08-25 Thread Nikolaj
Ah, that makes a lot more sense now. Your modified createfunc obviously doesn't account for queries with tuples of entities (some of which may also not be mapped) but I get the principle. I will just steer well clear of the memory backend - any production cache would obviously imply pickling and

Re: [sqlalchemy] Session.merge and multiple databases

2010-08-25 Thread Raf Geens
On 25/08/2010 17:15, Michael Bayer wrote: On Aug 25, 2010, at 10:50 AM, Raf Geens wrote: Hi, I have a sqlite database A and a MySQL database B which share the same schema, where I want to synchronize the contents of certain tables in A with those in B at certain times. Except for the

[sqlalchemy] Re: Support for CouchDB

2010-08-25 Thread phrrn...@googlemail.com
Roger Binns has incorporated support for CouchDB into apsw by using SQLite virtual tables. Although apsw cannot be used directly by SQLAlchemy (as it is not dbapi compliant), you can pass an apsw connection to pysqlite connect() and then use that connection as a SQLAlchemy engine. I did some

Re: [sqlalchemy] Session.merge and multiple databases

2010-08-25 Thread Raf Geens
On 25/08/2010 17:47, Raf Geens wrote: On 25/08/2010 17:15, Michael Bayer wrote: On Aug 25, 2010, at 10:50 AM, Raf Geens wrote: Hi, I have a sqlite database A and a MySQL database B which share the same schema, where I want to synchronize the contents of certain tables in A with those in B

RE: [sqlalchemy] Session.merge and multiple databases

2010-08-25 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Raf Geens Sent: 25 August 2010 16:48 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Session.merge and multiple databases On 25/08/2010 17:15, Michael Bayer wrote:

Re: [sqlalchemy] Session.merge and multiple databases

2010-08-25 Thread Raf Geens
On 25/08/2010 18:03, King Simon-NFHD78 wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Raf Geens Sent: 25 August 2010 16:48 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Session.merge and multiple databases

Re: [sqlalchemy] Re: Support for CouchDB

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 11:16 AM, Rawlins wrote: Hello Guys, Thanks for the info, i did expect that to be the case! I can understand that the architecture is indeed very different. As an extension to my question then, which DBMS would you guys recommend for stability. We have a small

Re: [sqlalchemy] Support for CouchDB

2010-08-25 Thread Chris Withers
Michael Bayer wrote: There's a long term plan to allow plugins that would provide attribute instrumentation and Session persistence services to objects that are persisted by a non-SQL database. I guess at this point you'd need to drop 'SQL' from 'SQLAlchemy' ;-) Chris -- Simplistix -

[sqlalchemy] Inter-Inheritance ForeignKeys - just need some assurance I'm doing it right

2010-08-25 Thread Michael Elsdörfer
I have, simplified, the following models: class Booking(db.Model): id = db.Column(db.Integer, primary_key=True) class PlanBooking(Booking): id = db.Column(db.Integer, db.ForeignKey(Booking.id), primary_key=True) class FeatureBooking(Booking): id = db.Column(db.Integer,

Re: [sqlalchemy] Inter-Inheritance ForeignKeys - just need some assurance I'm doing it right

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 3:07 PM, Michael Elsdörfer wrote: I have, simplified, the following models: class Booking(db.Model): id = db.Column(db.Integer, primary_key=True) class PlanBooking(Booking): id = db.Column(db.Integer, db.ForeignKey(Booking.id), primary_key=True) class

[sqlalchemy] problem with relationships with a postgres schema using declarative mapping

2010-08-25 Thread Nigel
Hi all, I'm having some trouble with using a schema with a many-to-many declarative mapping. The error i'm getting is as follows: sqlalchemy.exc.InvalidRequestError: One or more mappers failed to compile. Exception was probably suppressed within a hasattr() call. Message was: One or more

Re: [sqlalchemy] problem with relationships with a postgres schema using declarative mapping

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 4:57 PM, Nigel wrote: Hi all, I'm having some trouble with using a schema with a many-to-many declarative mapping. The error i'm getting is as follows: sqlalchemy.exc.InvalidRequestError: One or more mappers failed to compile. Exception was probably suppressed

[sqlalchemy] Re: problem with relationships with a postgres schema using declarative mapping

2010-08-25 Thread Nigel
Thanks very much for the quick reply. The second suggested worked nicely. I guess this explains why I was having such a hard time tracking down a similar situation online! Maybe I can sneak a second question in here which is to ask why the many - many connection table can not be created using

Re: [sqlalchemy] Re: problem with relationships with a postgres schema using declarative mapping

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 7:43 PM, Nigel wrote: Thanks very much for the quick reply. The second suggested worked nicely. I guess this explains why I was having such a hard time tracking down a similar situation online! Maybe I can sneak a second question in here which is to ask why the many

[sqlalchemy] Sudden Connection issues

2010-08-25 Thread Warwick Prince
Hi All This is my first post here, so I wish it were a little more spectacular.. :-) I have been working happily with SA 0.6.x on Windows 2003 server with MySQL and the Sun Python Connector. I have an identical config running (and working) on XP. I was testing my code which had been working

Re: [sqlalchemy] Sudden Connection issues

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 10:11 PM, Warwick Prince wrote: Hi All This is my first post here, so I wish it were a little more spectacular.. :-) I have been working happily with SA 0.6.x on Windows 2003 server with MySQL and the Sun Python Connector. I have an identical config running (and

Re: [sqlalchemy] Sudden Connection issues

2010-08-25 Thread Warwick Prince
HI Michael Excellent. Thanks for the pointers - I'll investigate further and get back to you. This is really strange as I do not believe that I changed anything from the point it all worked, to the point at which it didn't! (I'm sure there will be something however - there always is..).

Re: [sqlalchemy] Sudden Connection issues

2010-08-25 Thread Michael Bayer
On Aug 25, 2010, at 11:09 PM, Warwick Prince wrote: HI Michael Excellent. Thanks for the pointers - I'll investigate further and get back to you. This is really strange as I do not believe that I changed anything from the point it all worked, to the point at which it didn't! (I'm