nycflights13_sql: Create a standardised database for testing

Description Usage Arguments Value Examples

View source: R/nycflights13_sql.R

Description

Using the connection given in con, create a database including a few tables from the nycflights13 dataset.

Usage

1
nycflights13_sql(con, schema = "", ...)

Arguments

con

an SQL connection (i.e a PostgreSQL connection)

schema

schema to write the tables ("", or no schema by default)

...

additional parameters to connect to a database

Value

the connection given in con invisibly, generally called for the side effects of writing to the database

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Not run: 
connections <- list(
 odbc = DBI::dbConnect(
  odbc::odbc(),
  Driver   = "PostgreSQL Unicode",
  Server   = "127.0.0.1",
  Database = "postgres",
  UID      = "travis",
  PWD      = "",
  Port     = 5432
 ),
 rpostgresql = RPostgreSQL::dbConnect(
  drv      = DBI::dbDriver("PostgreSQL"),
  host     = "127.0.0.1",
  dbname   = "postgres",
  user     = "travis",
  password = "",
  port     = 5432
 ),
 rpostgres = DBI::dbConnect(
  drv      = RPostgres::Postgres(),
  host     = "127.0.0.1",
  dbname   = "postgres",
  user     = "travis",
  password = "",
  port     = 5432
 )
)

nycflights13_sql(connections$odbc, schema = "nycflights13")
# same as
# nycflights13_sql(connections$rpostgresql, schema = "nycflights13")
# also same as
# nycflights13_sql(connections$rpostgres, schema = "nycflights13")

## End(Not run)

pachamaltese/dbtest documentation built on Dec. 3, 2019, 11:08 p.m.