read_sqlite: Quickly query a SQLite database

View source: R/transfer.R

read_sqliteR Documentation

Quickly query a SQLite database

Description

Access a SQLite file and pass a standard query. This function deals with all the DBI work and will open/close the connection automatically. If you need to perform multiple operations it is advised to work with DBI directly.

Usage

read_sqlite(db_name, query, extended_types = TRUE, ...)

Arguments

db_name

Database name (full or relative path must be part of the name).

query

Character vector containing the SQL query.

extended_types

RSQLite parameter for additional data types such as dates (default: TRUE)

...

Additional parameters to be passed to dbGetQuery.

See Also

write2sqlite

Examples

## Not run: 
# Create a new DB and add first table in one swoop
write2sqlite('mydb.sqlite', mtcars, 'firsttable')

read_sqlite('mydb.sqlite', "SELECT * FROM firsttable")
read_sqlite('mydb.sqlite', "SELECT gear, count(*) AS N FROM firsttable GROUP BY gear")

## End(Not run)

al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.