[sqlalchemy] sAsync in complex project

2008-07-09 Thread zipito
Good day community. I don't know whether it is a good place to asc. I've used sqlalchemy with turbogears and there were no problems. Easy and strateforward. I've got lots of tables with lots of TableClasses where I implement application logic. Now I'm trying to use sqlalchemy with twisted. So

[sqlalchemy] result as the dict()

2008-07-05 Thread zipito
Good day community, there was similar theme - which ended without answer. How can I convert mine query results to list of dicts. I.e. I want the following select = session.select(MineTableObject) res = select.fetchall() res_list_dict = [dict(r) for r in res] but that doesn't works. dict(r)

[sqlalchemy] mapping and to the back

2008-06-19 Thread zipito
Good day community. first of all I want to say that I'm 2nd day with python... and SQLAlchemy so maybe I don't understand the whole idea I already have database (postgresql) for mapping mine database to classes I use such a thing (I'm using SQLAlchemy with trubogears) table_object =

[sqlalchemy] Re: mapping and to the back

2008-06-19 Thread zipito
On 19 июн, 20:12, [EMAIL PROTECTED] wrote: once mapped, the link is the otherway around:  class - mapper - sqltable. the backlink... u have to cache it yourself when u create things? e.g. mytablemap[tablename,schemaname]=TableClass why need that? i mean why starting from tablename? 'cause

[sqlalchemy] Re: mapping and to the back

2008-06-19 Thread zipito
make a mapper() decorator that does the accounting you want. from sqlalchemy.orm import mapper as _mapper my_table_registry = {} def mapper(cls, table, *args, **kwargs):      my_table_registry[(table.name, table.schema)] = cls      return _mapper(cls, table, *args, **kwargs) def