-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi ilya, everybody,
that time, i was using elixir and not the select() function in sa.
elixir.query.filter() returned a list of objects, with their fields as
attributes (same as the entity definition in elixir).
thus, to have each record transformed in a dict, i have used a transformation
function, and an iterator converter, like the following:
~ def prep_record(record):
~ values = {}
~ for field in allfields: #a list of field names
~ values[field] = getattr(record, field)
~ records = itertools.imap(prep_record, query)
now i'm using sa 0.4.6, and when i'm executing a select() on a session, i'm
getting a resultproxy object, which may be iterated by rows, and each field of
each row may be got by row[fieldname]
hope this helps,
alex
zipito wrote:
| good day alex
|
|
| Did you find the solution for this ?
|
|
| Best regards,
| Ilya Dyohsin
|
| On 17 янв, 06:06, alex bodnaru <[EMAIL PROTECTED]> wrote:
| hi mike,
|
| thanks for your prompt answer.
|
| it doesn't work anymore, indeed :(
|
| alex
|
|
|
| Michael Bayer wrote:
|
|>>> what, likedict(row) ? that should work....no ?
|>>> On Jan 16, 2008, at 6:29 PM, alex bodnaru wrote:
|>>> hi friends,
|>>> in older sa i could cast a record to adict, in order to access their
|>>> fields by their name, especially if the field name is not a valid
|>>> python
|>>> identifier, like a calculated or fixed numeric column.
|>>> how could i do it again please?
|>>> tia,
|>>> alex
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQCVAwUBSHCg8dpwN1sq38njAQKIxAP/Y8eKEMm18qI12ZEtmw2nwq+z9HB8ykjY
g/w3ErQvfcOp3K9bFqL7/1MHgIIVATy636rQbe1F7wZYkR3NaQlKlkdVt8Z+YSxu
zmLeR4EL+q1CgnuJTsRh5+xRxqzdUZf4vEAFKipjGwrOvJT4EglY/CqUNx0AZpwP
LTQC456nCPQ=
=imB5
-----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---