Forget about that, I can just do :
table1 = fromdicts(db.executesql('select * from table1', as_dict=True))
look(table1)
Bingo!
The only drawback I think is that the column with never be in the same
order, but it is a detail since I can reorder easilly with petl...
Richard
On Fri, Feb 8, 2013 at 2:04 PM, Richard Vézina
<[email protected]>wrote:
> Let petl fromdb() do it works as formatting raw SQL output for petl
> process and avoid writting a custom parser for that. I thought I could just
> wrote a new fromdb() that use db.executesql() as input.
>
> Richard
>
>
> On Fri, Feb 8, 2013 at 1:55 PM, Ovidio Marinho <[email protected]>wrote:
>
>> the reason to use it and not use the default connection?
>>
>>
>>
>> Ovidio Marinho Falcao Neto
>> Web Developer
>> [email protected]
>> [email protected]
>> ITJP - itjp.net.br
>> 83 8826 9088 - Oi
>> 83 9336 3782 - Claro
>> Brasil
>>
>>
>>
>> 2013/2/8 Richard <[email protected]>
>>
>>> Hello,
>>>
>>> I would know if there is any issue that could happen if I connect
>>> directly to the database with psycopg2...
>>>
>>> Something like this in modules :
>>>
>>> import psycopg2
>>> from petl import *
>>> connection = psycopg2.connect("dbname='db' user='user' password='pwd'
>>> host='localhost'")
>>> table1 = fromdb(connection, "SELECT * FROM table")
>>>
>>> I would have use dal directly inside the petl
>>> fromdb(db.executesql('select * from table')) to avoid an other database
>>> connection, but petl fromdb have strict requirement...
>>>
>>> I read in the pass that petl integration was planning, but is there any
>>> body working on this??
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.