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
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)
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 =
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
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