Execute an SQL query in a database
db_query( sql, db, ..., sql_formatter = getOption("dbr.sql_formatter"), output_format = getOption("dbr.output_format") )
sql | string |
---|---|
db | database reference by name or object |
... | passed to |
sql_formatter | function to be applied on |
output_format | preferred output format that defaults to |
data.frame with query metadata
if (FALSE) { options('dbr.db_config_path' = system.file('example_db_config.yaml', package = 'dbr')) db_query('SELECT 42', 'sqlite') db_query('SELECT {40 + 2}', 'sqlite') }