# Converting LibPQ result into dataframe

**URL:** <https://discourse.julialang.org/t/converting-libpq-result-into-dataframe/26567>\
**Category:** New to Julia\
**Tags:** dataframes, help-database\
**Created:** [July 19, 2019, 11:03pm UTC](https://discourse.julialang.org/t/converting-libpq-result-into-dataframe/26567 "2019-07-19T23:03:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abeburnett](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abeburnett/32/8974_2.png) [@abeburnett](https://discourse.julialang.org/u/abeburnett)\
**Post date:** [July 19, 2019, 11:03pm UTC](https://discourse.julialang.org/t/converting-libpq-result-into-dataframe/26567/1 "2019-07-19T23:03:09Z")

</div>

So coming from R and Python I’m finding it astonishingly mysterious how I can connect to my Postgres DB and pull (select) data down into a dataframe format. I discovered the LibPQ package, but the documentation is very cursory, and doesn’t cover selecting data at all, much less converting that data into any paradigm I understand.

So, my question is: how do I transform the LibPQ result (from a select query) into a standard dataframe?

Thank you!

---

<div class="post-metadata">

**Author:** ![fborda](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fborda/32/8654_2.png) [@fborda](https://discourse.julialang.org/u/fborda)\
**Post date:** [July 19, 2019, 11:26pm UTC](https://discourse.julialang.org/t/converting-libpq-result-into-dataframe/26567/2 "2019-07-19T23:26:03Z")

</div>

```julia
DataFrame(execute(conn, "SELECT * FROM table"))

```

This should work because LibPQ returns a table that comply with the [Tables.jl](https://github.com/JuliaData/Tables.jl) interface.
