[sqlalchemy] How to write a self 2 self relationship?

2009-02-16 Thread 一首诗
I tried to write : # class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) fullname = Column(String) password = Column(String) sons =

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread az
put it as text, it will be eval()'uated later On Monday 16 February 2009 10:57:11 一首诗 wrote: I tried to write : #-- -- class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True)

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is covered by the decl. layer documentation (including examples): - either use strings for the parameter or - you write outside the class scope User.sons = relation() - -aj On 16.02.2009 9:57 Uhr, 一首诗 wrote: I tried to write :

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread 一首诗
Like this ? class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) fullname = Column(String) password = Column(String) sons =

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread az
thats diff. thing, see self-ref. relations http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships On Monday 16 February 2009 11:18:59 一首诗 wrote: Like this ? --- - class User(Base):

[sqlalchemy] Re: single table inheritance : query a subtype and its subtypes

2009-02-16 Thread GustaV
Oh my mistake. It works totally! On 13 fév, 21:29, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 13, 2009, at 12:05 PM, GustaV wrote: Hello! In a configuration looking like this: class Parent:   pass class Child(Parent):   pass class ChildChild(Child):   pass I

[sqlalchemy] Trac feed broken

2009-02-16 Thread Gaetan de Menten
It seems like there is some bad character in one of the ticket details as it's been a few days since I could access the Trac feed. My feed reader (liferea) complains of: XML Parsing Error: reference to invalid character number Location: file:/// Line Number 20, Column 14:pre

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread Alexandre Conrad
So, does sqlalchemy support self 2 self relationship ? If the answer is YES, how to do it? You may want to look at the remote_side keyword argument. http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships Regards, Alex

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread Alexandre Conrad
As I said in my previous mail, you really should look at the remote_side keyword argument in your relation. This is what it was done for and the paragraph adjacency-list-relationships from the documentation covers all you need to know to deal with self-referential relationships. Here's the link

[sqlalchemy] Re: A question about best practices after the Object Relational Tutorial

2009-02-16 Thread Jessica Meyer
Thank you for your replies. With helper code I mean: I want the architecture of my program so: - There's a database - Only SQLAlchemy talks to the database - There is a function for every task that SQLAlchemy does So, I want to do something like this in the end: addCustomer

[sqlalchemy] DataError inserting CURRVAL in an inline query with SQLAlchemy and SQLSoup

2009-02-16 Thread Jeff Cook
Hi all, I want to use the return value of a CURRVAL call as the value of a column in a row I'm inserting, to link together related records. I'm using Pylons with SQLAlchemy and SQLSoup. SQLAlchemy spits back at me a DataError because I'm trying to place CURRVAL in an integer field. How do I get

[sqlalchemy] Re: DataError inserting CURRVAL in an inline query with SQLAlchemy and SQLSoup

2009-02-16 Thread Michael Bayer
use func.currval(literal_column('users_user_id_seq')).though I'm not sure how SQLSoup is going to pass that in, its what *should* work. On Feb 16, 2009, at 7:03 PM, Jeff Cook wrote: Hi all, I want to use the return value of a CURRVAL call as the value of a column in a row I'm

[sqlalchemy] Re: Trac feed broken

2009-02-16 Thread Michael Bayer
it says to me: Congratulations! [Valid RSS] This is a valid RSS feed. im not able to reproduce any issue in the straight FF reader. On Feb 16, 2009, at 6:54 AM, Gaetan de Menten wrote: It seems like there is some bad character in one of the ticket details as it's been a few days

[sqlalchemy] Re: A question about best practices after the Object Relational Tutorial

2009-02-16 Thread Randall Smith
I would put the addCustomer method on something other than the customer object, like the thing you're adding the customer to. Or bettery yet, you'd probably be just appending the customer. I think for your specific example, you should handle customer creation stuff (login + password) in

[sqlalchemy] Re: DataError inserting CURRVAL in an inline query with SQLAlchemy and SQLSoup

2009-02-16 Thread jo
You cannot pass currval('users_user_id_seq') as a parameter value, you have to pass an integer value instead. I solved this problem in this way: INSERT INTO employees (employee_user_id, employee_id, employee_first_name, employee_last_name, employee_address, employee_city, employee_state,