+1

On Monday, 3 June 2019 09:51:56 UTC-7, Leonel Câmara wrote:
>
> Sorry to dig this thread up, but I had to take a look at this recently.  
>   
> I think the most efficient way is to use pydal to make the sql query and 
> then have pandas do it. As an example say you want a dataframe which has 
> the user's id and their first_name
>
> import pandas as pd
> conn = db._adapter.connection
> sqlquery = pd.read_sql_query(db(db.auth_user.id > 0)._select(db.auth_user.
> id, db.auth_user.first_name), conn)
> df = pd.DataFrame(sqlquery, columns=["id", "first_name"])
>
> This uses the connection to the database already done by pydal, it uses 
> sql produced by pydal, however pydal does not process the result as it goes 
> directly to pandas.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7f4a5b1f-a0f0-4e28-bad6-988176d4bae0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to