# Interface FunSQL with LibPQ using DBInterface

**URL:** <https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635>\
**Category:** General Usage\
**Tags:** package\
**Created:** [May 30, 2023, 10:35pm UTC](https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635 "2023-05-30T22:35:01Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [July 5, 2023, 8:00pm UTC](https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635/6 "2023-07-05T20:00:31Z")

</div>

Thanks. I am not proficient with loading pull requests but was able to look over the source code of the changes made to LibPQ. I then added the new function ‘DBInterface.close!’ that was not included in the [FunSQL manual](https://mechanicalrabbit.github.io/FunSQL.jl/stable/examples/#Database-connection-with-LibPQ.jl). For reference for others looking at this my solution until the new LibPQ is released is below. This is similar to the [PR](https://github.com/chris-b1/LibPQ.jl/blob/dbinterface/src/dbinterface.jl).

```julia
using DBInterface
using FunSQL:
    FunSQL, Agg, Append, As, Asc, Bind, CrossJoin, Define, Desc, Fun, From,
    Get, Group, Highlight, Iterate, Join, LeftJoin, Limit, Lit, Order,
    Partition, Select, Sort, Var, Where, With, WithExternal, render
using LibPQ

# bring libraries and helper functions into scope for integrating FunSQL and LibPQ

DBInterface.connect(::Type{LibPQ.Connection}, args...; kws...) =
LibPQ.Connection(args...; kws...)

DBInterface.prepare(conn::LibPQ.Connection, args...; kws...) =
LibPQ.prepare(conn, args...; kws...)

DBInterface.execute(conn::Union{LibPQ.Connection, LibPQ.Statement}, args...; kws...) =
LibPQ.execute(conn, args...; kws...)

DBInterface.close!(conn::LibPQ.Connection) = close(conn)

```

---

_[View the full topic](https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635)._
