Skip to content

Commit

Permalink
Improve the docs for from_query/4 (#946)
Browse files Browse the repository at this point in the history
  • Loading branch information
cigrainger authored Jul 16, 2024
1 parent aeae416 commit 3124d32
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/explorer/data_frame.ex
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,16 @@ defmodule Explorer.DataFrame do
# When using the conn PID directly
{:ok, _} = Explorer.DataFrame.from_query(conn, "SELECT 123", [])
Parameterized queries are possible by passing a list of parameters as the third argument. The
query string will use a different placeholder depending on the driver. For example, `?` for
SQLite and `$1`, `$2`, etc. for PostgreSQL.
# For SQLite
{:ok, _} = Explorer.DataFrame.from_query(conn, "SELECT ?", [123])
# When using PostgreSQL
{:ok, _} = Explorer.DataFrame.from_query(conn, "SELECT $1", [123])
## Options
* `:backend` - The Explorer backend to use. Defaults to the value returned by `Explorer.Backend.get/0`.
Expand Down

0 comments on commit 3124d32

Please sign in to comment.