connection-info: Utilities for extracting related information about a database...

Description Usage Arguments Value Author(s) See Also Examples

Description

For a given database connection, these functions return the user name, host, database name, info about database management system, connection, the version of MADlib installed on this database, the schema name of MADlib installation, and the R package that is used to connect to this database.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19

Arguments

conn.id

Default value is 1. The database connection ID number con.id. It is an integer.

Value

For user, a string, which is the user name.

For host, a string, which is the host address.

For dbname, a string, which is the database name.

For dbms, a string, which is DBMS version information.

For conn, an object of DBI connection, which can be directly used with packages such as RPostgreSQL.

For port, an integer, which is the port number of the connection.

For madlib, a string, which is the MADlib version information.

For madlib.version, a string, exactly the same as madlib.

For schema.madlib, a string, which is the schema name of MADlib installation.

For conn.pkg, a string, which is the name of the R package that has been used to connect to this database.

Author(s)

Author: Predictive Analytics Team at Pivotal Inc.

Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io

See Also

db.connect creates connections to the databases.

db.disconnect disconnects an existing connection.

db.list lists all the current connections with their information.

conn.eql tests whether two connections are actually the same one.

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
## Not run: 


## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid1 <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)
cid2 <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)

user(cid1)
host(cid2)
dbname(cid1) # use default connection 1
dbms(cid1)
madlib(cid1)
madlib.version(cid1)
schema.madlib(cid1)
conn.pkg(cid1)

## conn is mostly for other packages
con <- conn(cid1) # get the connection object
dbListTables(con) # directly use functions in package RPostgreSQL

## This package provides a better function to list all tables/views
db.objects(cid1) # list all tables/views with their schema in connection 1

db.disconnect(cid1, verbose = FALSE)
db.disconnect(cid2, verbose = FALSE)

## End(Not run)

PivotalR documentation built on March 13, 2021, 1:06 a.m.