Run a query against a GlareDB database
Usage
glaredb_sql(query, connection = NULL)
glaredb_prql(query, connection = NULL)
glaredb_execute(query, connection = NULL)
Arguments
- query
A character of the query to run.
For
glaredb_sql()
andglaredb_execute()
, an SQL query.For
glaredb_prql()
, a PRQL query.
- connection
A GlareDB connection object or
NULL
. IfNULL
, the default in-memory database is used.
Examples
glaredb_sql("SELECT 'hello from R' as hello") |>
as_glaredb_table()
#> ┌──────────────┐
#> │ hello │
#> │ ── │
#> │ Utf8 │
#> ╞══════════════╡
#> │ hello from R │
#> └──────────────┘
glaredb_prql("from [
{a=5, b=false},
{a=6, b=true},
]") |>
as_glaredb_table()
#> ┌───────┬─────────┐
#> │ a │ b │
#> │ ── │ ── │
#> │ Int64 │ Boolean │
#> ╞═══════╪═════════╡
#> │ 5 │ false │
#> │ 6 │ true │
#> └───────┴─────────┘
glaredb_execute("CREATE TABLE my_table (a int)")
glaredb_execute("INSERT INTO my_table VALUES (1), (2)")
glaredb_sql("SELECT * FROM my_table") |>
as_glaredb_table()
#> ┌───────┐
#> │ a │
#> │ ── │
#> │ Int32 │
#> ╞═══════╡
#> │ 1 │
#> │ 2 │
#> └───────┘