[sqlalchemy] Re: M:N self-reference

2009-11-09 Thread Wade Leftwich
Something exactly like that. Thanks much. On Nov 8, 11:28 pm, Mike Conley mconl...@gmail.com wrote: Something like this? The association table is declared in the relationships, but never referenced when creating or accessing objects. class Assoc(Base):     __tablename__ = 'assoc'    

[sqlalchemy] what time sqlalchemy 0.6 out?

2009-11-09 Thread 诚子
RT, i'm using it now, i want it's out when i product is online. -- my.unix-center.net/~WeiZhicheng --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] insertion of an object with a user defined field value

2009-11-09 Thread (e.g. emre)
Hi, I have the following 2 declarative objects to represent a book and its pages: class Book(Base): __tablename__ = 'books' id = Column(Integer, primary_key=True) title = Column(String(32)) class Page(Base): __tablename__ = 'pages' id = Column(Integer, primary_key=True)

[sqlalchemy] Re: insertion of an object with a user defined field value

2009-11-09 Thread Mike Conley
The id is generate by the database engine, not SQLAlchemy, so session.add() does nothing to push your object to the database and generate the id. You need to execute session.flush() after session.add() to write the book to the database and generate the id. After the flush() operation, the book id

[sqlalchemy] Re: insertion of an object with a user defined field value

2009-11-09 Thread (e.g. emre)
Thanks for the quick response. However, the problem I face is not being able to access the id assigned by database but not being able to modify the corresponding field in Page instance. To be more clear: bk_ids = {} for title in ('Tom Sawyer', 'Huck Finn'): book = Book(title=title)

[sqlalchemy] Re: insertion of an object with a user defined field value

2009-11-09 Thread Mike Conley
Using your class definitions, it seems to work. What is different? Base.metadata.bind=create_engine('sqlite:///') Base.metadata.create_all() session=sessionmaker()() bk_ids = {} for title in ('Tom Sawyer', 'Huck Finn'): book = Book(title=title) session.add(book) session.flush()

[sqlalchemy] Re: little trouble remote_side when local col points to same col in parent

2009-11-09 Thread David Gardner
Actually I hadn't realized that the problem only occurred on eagerloading. Would it make sense to be able to do an alias at the table level? In other words: task_parent=aliased(task_table) mapper(Task,task_table, properties={ 'Children' : relation(Task, backref=backref('Parent',

[sqlalchemy] Re: insertion of an object with a user defined field value

2009-11-09 Thread (e.g. emre)
It does indeed! It is my bad, it works as expected, the problem was due to not flushing properly before storing the values in the dictionary. Sorry for the inconvenience and thank you for the support. On Nov 9, 4:46 pm, Mike Conley mconl...@gmail.com wrote: Using your class definitions, it

[sqlalchemy] using having

2009-11-09 Thread Gabriel
how can i use having? example: targets = meta.Session.query(ObjetoCusto.objeto_custo_id, ObjetoCusto.descricao).\ join(TipoObjeto).\ join(EtapaObjeto).\ filter(EtapaObjeto.ano_id == c.year).\

[sqlalchemy] Re: little trouble remote_side when local col points to same col in parent

2009-11-09 Thread Michael Bayer
On Nov 9, 2009, at 1:09 PM, David Gardner wrote: Actually I hadn't realized that the problem only occurred on eagerloading. Would it make sense to be able to do an alias at the table level? In other words: task_parent=aliased(task_table) mapper(Task,task_table, properties={

[sqlalchemy] Re: little trouble remote_side when local col points to same col in parent

2009-11-09 Thread David Gardner
Thanks for looking into this, just as an fyi this isn't effecting any production code for me, I still have the option of implementing parent/children using an integer id's column. Michael Bayer wrote: at that level. you'd at least want to use a table alias, i.e. task_table.alias() - but

[sqlalchemy] Re: what time sqlalchemy 0.6 out?

2009-11-09 Thread Michael Bayer
we are looking at feburary at the latest, hopefully. On Nov 9, 2009, at 5:14 AM, 诚子 wrote: RT, i'm using it now, i want it's out when i product is online. -- my.unix-center.net/~WeiZhicheng --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: Server / Client-gtk app

2009-11-09 Thread Michael Bayer
On Nov 8, 2009, at 5:06 PM, M3nt0r3 wrote: Hi , i am sorry for my english, i am trying ti make a Server/Client app. Until now client-gtk mapped the db and spoked directly with the db ( sqlite and postgresql atm) . I wrote a small wsgi server based on werkzeug, and it basically make the