Re: [Sqlalchemy-users] primaryjoin, secondary join

2006-07-29 Thread Michael Bayer
this mapper setup would imply that the InvasiveName is mapped to the languages table. which im guessing is not the case. is there a Languages object ? it seems like youre looking for the association object pattern here instead of the straight many-to-many. On Jul 26, 2006, at 3:29 AM,

Re: [Sqlalchemy-users] two relations back to one table

2006-07-29 Thread Kevin Dangoor
On 7/26/06, Kevin Dangoor [EMAIL PROTECTED] wrote: I've got a table that has two separate columns pointing back to another table. I've set up relations for both of those and I used primaryjoin to specify which field is used for each relation (that's where I might be going wrong). The first

Re: [Sqlalchemy-users] running on macintosh servers

2006-07-29 Thread Brian Jarrett
Thanks, Jonathan, that confirms what I'm seeing as well. I do have a shell account on a mac now so within the next week I should be testing my code on it to see if it works OK. There is something called Darwin ports that seems to be a package manager of sorts for OS X. There is a ports package

[Sqlalchemy-users] How to relate a table to itself (many_to_many) in ActiveMapper

2006-07-29 Thread Sanjaya Kumar Patel
It just came to my mind that this kind of relationship, as I remember, can be handled by Rails ActiveRecord. So, just curious to know whether this can be in store in future, or there is any technical infeasiblity which prevents ActiveMapper to follow Rails ActiveRecord pattern fully. Thanks

[Sqlalchemy-users] wrong engine attribute on session

2006-07-29 Thread Randall Smith
I'm working with TurboGears which defines a session like so: def create_session(): Creates a session with the appropriate engine return sqlalchemy.create_session(bind_to=get_engine()) session = activemapper.Objectstore(create_session) This code: # tg_session

Re: [Sqlalchemy-users] running on macintosh servers

2006-07-29 Thread Kapil Thangavelu
yes, sqlalchemy runs on osx, no most of the db adapters need to be compiled and installed (though they work), and the test suite requires 2.4 (not sure about the rest), yes all of these things can be distributed in a disk image w/ an application. -k On Tue, 25 Jul 2006 11:38:38 -0700, Brian

[Sqlalchemy-users] instances() possibly needs to compile

2006-07-29 Thread Kevin Dangoor
I just ran into a case where I have a mapper that does not appear to be compiled because I was using select() and then followed that with instances(). Adding a compile call in my code fixed the problem. Kevin -- Kevin Dangoor TurboGears / Zesty News email: [EMAIL PROTECTED] company:

[Sqlalchemy-users] sqlite is a pita

2006-07-29 Thread Jonathan Ellis
Looks like SA doesn't reflect defaults for sqlite tables for the excellent reason that sqlite does a piss-poor job of providing that information. Grr.But, sqlite _does_ indicate that _some_ default exists. As far as I can tell, SA only really cares about the contents of a PD when it's going to

Re: [Sqlalchemy-users] SQLAlchemy and Firebird SQL

2006-07-29 Thread Jonathan Ellis
On 7/26/06, Oleg Deribas [EMAIL PROTECTED] wrote: users_table.create()i = users_table.insert()print i-And it gives me this:AttributeError: 'NoneType' object has no attribute 'has_key' Well, you should be able to print out an

Re: [Sqlalchemy-users] running on macintosh servers

2006-07-29 Thread Michael Bayer
SQLAlchemy was almost entirely developed on an OSX laptop, where I can run all the unit tests for sqlite, postgres, and mysql using the respective DB modules. I did build my own version of python 2.4, but python 2.3 works too (py2.2, not so much). Jonathan Ellis wrote: On 7/25/06, Brian

Re: [Sqlalchemy-users] cascade rules - how do I on delete set null?

2006-07-29 Thread Michael Bayer
Brad Clements wrote: given a one-to-many, and the one is deleted I want the many's to be set null. How do I specify that in a relation cascade rule? cascade=null-orphan ? for the many's to be set null, thats what it does by default, when you detach the child object from the parent, or

Re: [Sqlalchemy-users] session only tracks mapper relations, not table foreign keys?

2006-07-29 Thread Michael Bayer
Brad Clements wrote: I'm going to use backref to work around this, I bet that will resolve the problem, but I'm curious why the mapper doesn't discover foreignkeys itself and watch for direct manipulation.. it doesnt look at the foreign key values themselves; the ORM just looks at

Re: [Sqlalchemy-users] SQLAlchemy and Firebird SQL

2006-07-29 Thread Uwe Grauer
Oleg Deribas wrote: Hello, I'm trying to investigate possibility to use SQLAlchemy with Firebird SQL. And I've wrote this simple script following tutorial: - from sqlalchemy import * db =

Re: [Sqlalchemy-users] problem with primary mapper

2006-07-29 Thread Jonathan Ellis
On 7/29/06, POX [EMAIL PROTECTED] wrote: Hi,Why undermentioned code will not work with SA 0.2.6 anymore?sqlalchemy.exceptions.ArgumentError: Class 'class '__main__.Bar'' already has a primary mapper defined.Use is_primary=True to assign a new primary mapper to the class, or use non_primary=True to

Re: [Sqlalchemy-users] problem with primary mapper

2006-07-29 Thread POX
Jonathan Ellis ([EMAIL PROTECTED]): On 7/29/06, POX [EMAIL PROTECTED] wrote: Why undermentioned code will not work with SA 0.2.6 anymore? sqlalchemy.exceptions.ArgumentError: Class 'class '__main__.Bar'' already has a primary mapper defined. Use is_primary=True to assign a new primary mapper

Re: [Sqlalchemy-users] delimited identifiers with postgresql

2006-07-29 Thread Aaron Spike
Aaron Spike wrote: sqlalchemy.exceptions.SQLError: (ProgrammingError) parser: parse error at or near : at character 148 'SELECT vPersons.Person_ID, vPersons.Person_LastFirstM, vPersons.Person_LastName \nFROM vPersons \nWHERE vPersons.Person_La stName = :vPersons_Person_LastName'

Re: [Sqlalchemy-users] problem with primary mapper

2006-07-29 Thread Michael Bayer
youre only allowed to define one primary mapper per class. by having assign_mapper in the constructor of a class, creating a new mapper for the Bar class which is in a static context, it creates a new mapper for the Bar class each time Foo's __init__ is called; all calls to this after the first

Re: [Sqlalchemy-users] delimited identifiers with postgresql

2006-07-29 Thread Michael Bayer
theres a ticket in Trac to support quoted identifiers. its not implemented yet, but it will involve you putting a flag quote=True on your Table definition (since i dont want impose the quoting stuff on people unless people specifically want it). Aaron Spike wrote: In my first few minutes

Re: [Sqlalchemy-users] delimited identifiers with postgresql

2006-07-29 Thread Aaron Spike
Michael Bayer wrote: theres a ticket in Trac to support quoted identifiers. its not implemented yet, but it will involve you putting a flag quote=True on your Table definition (since i dont want impose the quoting stuff on people unless people specifically want it). Are you refering to #240

Re: [Sqlalchemy-users] delimited identifiers with postgresql

2006-07-29 Thread Michael Bayer
ticket #155. theres some patches there that are very close to how it should be done. i didnt like the quote_string function being called so often but there might not be any way around that (i.e. maybe the quote=True flag not really worth it). what this patch would need is, support for other