[sqlalchemy] family tree

2007-09-27 Thread jawarumnur
Hello, I'd like to build something like a family tree where descendants, mother and father are properties (of each person-object) defined by a mapper. When these properties are accessed, one (in case of mother or father) new person-object schould be loaded, or a list of person-objects (in case

[sqlalchemy] Re: family tree

2007-09-27 Thread jawarumnur
You might want to have a look at Adjacency List Relationships: http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_relatio... Thanks for your reply. But that is what I already looked at and tried to use, but it didn't work. I think the problem is, that there are two columns (mother

[sqlalchemy] Re: family tree

2007-09-27 Thread jawarumnur
Ok, I just read about the relation option foreign_keys... I think, that might be the 'magic' of the whole thing^^ sry, for bothering you, jawa --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To

[sqlalchemy] aliased tables

2007-09-27 Thread Glauco
Hi all, how can i know the correct name of a table compiled into qry that SA has automatically aliased? for example: a join b join c join d.. sqlalchemy has created something like select blabla from a AS anon_b406 join. when i try to put into an order by a obviously the qry goes

[sqlalchemy] Re: family tree

2007-09-27 Thread jawarumnur
thanks, I'll try that, if the relation option foreign_keys didn't do it. I'd like to get normal properties with normal getter and setter or append methods. I use sqlalchemy because I don't want to write all these methods by myself ;) greetz, jawa

[sqlalchemy] Re: family tree

2007-09-27 Thread Arnar Birgisson
On 9/27/07, jawarumnur [EMAIL PROTECTED] wrote: thanks, I'll try that, if the relation option foreign_keys didn't do it. I think you don't need foreign_keys. The docs for foreign_keys states that it should be used in conjuction with primaryjoin only if SA can not guess the FK from the join

[sqlalchemy] Re: family tree

2007-09-27 Thread jawarumnur
mh, you're right. I'm not yet very familiar with sqlalchemy since this is my first try. I thought about a WHERE clause additional to the join condition to differentiate the genders but probably that won't work either. I'll try to use python properties then, I think. thanks, jawa

[sqlalchemy] Re: aliased tables

2007-09-27 Thread Roger Demetrescu
Hi Glauco On 9/27/07, Glauco [EMAIL PROTECTED] wrote: Hi all, how can i know the correct name of a table compiled into qry that SA has automatically aliased? for example: a join b join c join d.. sqlalchemy has created something like select blabla from a AS anon_b406 join.

[sqlalchemy] Re: aliased tables

2007-09-27 Thread Glauco
Roger Demetrescu ha scritto: Hi Glauco On 9/27/07, Glauco [EMAIL PROTECTED] wrote: Hi all, how can i know the correct name of a table compiled into qry that SA has automatically aliased? for example: a join b join c join d.. sqlalchemy has created something like select blabla

[sqlalchemy] Bug in SA-0.4b6

2007-09-27 Thread Hermann Himmelbauer
Hi, I have problem here with SA-0.4b6: I created an own table that inherits from sqlalchemy.Table like this: class MyTable(sqlalchemy.Table): pass When I now create tables using this class (e.g. mytable = MyTable(...)), the tables are not created via metadata.create_all(). The log files

[sqlalchemy] Re: aliased tables

2007-09-27 Thread Roger Demetrescu
On 9/27/07, Glauco [EMAIL PROTECTED] wrote: If so, I think I know what you are doing wrong... you must use Query's .join() or .outerjoin() method. Like that: session.query(ObjectA).join('property_b').order_by(ObjectB.c.foobar) Where 'foobar' maps to the column from B table which you want

[sqlalchemy] Re: Bug in SA-0.4b6

2007-09-27 Thread Michael Bayer
On Sep 27, 2007, at 10:07 AM, Hermann Himmelbauer wrote: With SA-3.10 I don't have this problem. So, I assume, this is a bug? I woudlnt consider this a bug since subclassing of tables was never something supported. however, to make it work do this: class MyTable(Table):

[sqlalchemy] Re: aliased tables

2007-09-27 Thread Glauco
Glauco, can you send a small test script reproducing the error ? I'll gladly take a look at that... Cheers, Roger Yes... this is the example session.query( UnitaAziendale ).order_by(Anagrafica.c.nome) (ProgrammingError) invalid reference to FROM-clause entry for table

[sqlalchemy] Re: SQLAlchemy 0.4beta6 released !!

2007-09-27 Thread Michael Bayer
On Sep 27, 2007, at 12:17 AM, Jose Galvez wrote: Dear Micheal, Does this mean that with web apps since the session is now weak referencing that we will no longer have to call Session.remove() to clear out Sessions? Specifically I'm referencing what Mike Orr wrote in the

[sqlalchemy] Re: aliased tables

2007-09-27 Thread Roger Demetrescu
On 9/27/07, Glauco [EMAIL PROTECTED] wrote: Glauco, can you send a small test script reproducing the error ? I'll gladly take a look at that... Cheers, Roger Yes... this is the example session.query( UnitaAziendale ).order_by(Anagrafica.c.nome) SNIP Thanks Glauco... But

[sqlalchemy] Re: SQLAlchemy 0.4beta6 released !!

2007-09-27 Thread jose
Thanks for the info and thanks for some great software Jose On Sep 27, 8:03 am, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 27, 2007, at 12:17 AM, Jose Galvez wrote: Dear Micheal, Does this mean that with web apps since the session is now weak referencing that we will no longer have

[sqlalchemy] OID usage

2007-09-27 Thread Eric N
I apologize in advance for the size of this post, but I want to provide as much info as possible. I work for a large company and I am trying to use SqlAlchemy to implement a cleaner interface to one of our databases. The database is Sql Server 2005, the app runs on RHEL 3 under Python 2.5. I am

[sqlalchemy] polymorphic question

2007-09-27 Thread sdobrev
i know in 0.4 one can request a polymorphic request to be automaticaly split into multiple per-subtype requests. i've no idea how this compares +/- to the huge union/outerjoin that gives all in one long shot. my question is.. can this mechanism/approach be used somehow for (semi) automatic

[sqlalchemy] Re: 0.4 and server-side cursors

2007-09-27 Thread Dan Watson
looks like it won't work using psycopg2's named cursor implementation, at least not without some patching. it seems like psycopg should fill in cursor.description after it issues the DECLARE, but it doesn't. you can do it using one normal (non-named) cursor in SA using the method above, but it

[sqlalchemy] Re: OID usage

2007-09-27 Thread sdobrev
just some ideas. Here is an example of a properly interpreted row using the dbutils.OID class: 08C82B7C6A844743::SDRAM::64Mb::Marketing::0C::70C::DC Electrical Characteristics Here is the binding statement being generated by SqlAlchemy: 2007-09-27 13:32:12,444 INFO

[sqlalchemy] Re: OID usage

2007-09-27 Thread Michael Bayer
On Sep 27, 2007, at 4:11 PM, Eric N wrote: I'm wondering if SqlAlchemy is quoting the parameter when it is bound or if anyone has any other suggestions as to why I am not getting any results. we're not quoting anything when its bound...what gets returned from convert_bind_param is what

[sqlalchemy] Re: polymorphic question

2007-09-27 Thread Michael Bayer
On Sep 27, 2007, at 3:53 PM, [EMAIL PROTECTED] wrote: i know in 0.4 one can request a polymorphic request to be automaticaly split into multiple per-subtype requests. i've no idea how this compares +/- to the huge union/outerjoin that gives all in one long shot. my question is.. can this

[sqlalchemy] Beta6 - sqlsoup - SADeprecationWarning

2007-09-27 Thread Catalin Constantin
Hello, I get the following warning message, after the upgrade to 0.4 beta6. /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta6-py2.4.egg/ sqlalchemy/ext/sqlsoup.py:356: SADeprecationWarning: SessionContext is deprecated. Use scoped_session(). Is there any quickfix ? Thank you