src_postgres: Setup a PostgreSQL database connection

View source: R/src_postgres.R

src_postgresR Documentation

Setup a PostgreSQL database connection

Description

Setup a PostgreSQL database connection

Usage

src_postgres(dbname = "test", host = "localhost", port = 5432L, ...)

Arguments

dbname

(character) name of database, has to exist to open a connection

host

(character) host of the database, see RPostgres::Postgres()

port

(integer) port of the database, see RPostgres::Postgres()

...

additional named parameters passed on to RPostgres::Postgres()

Details

Uses RPostgres as backend. nodbi creates or uses a PostgreSQL table, with columns ⁠_id⁠ and json created and used by package nodbi, applying SQL functions as per https://www.postgresql.org/docs/current/functions-json.html to the json column. Each row in the table represents a JSON document. Any root-level ⁠_id⁠ is extracted from the document(s) and used for column ⁠_id⁠, otherwise a UUID is created as ⁠_id⁠. The table is indexed on ⁠_id⁠. A custom plpgsql function jsonb_merge_patch() is used for docdb_update(). The order of variables in data frames returned by docdb_get() and docdb_query() can differ from their order the input to docdb_create(). For a benchmark, see https://github.com/ropensci/nodbi#benchmark

Value

A nodbi source object

Examples

## Not run: 
con <- src_postgres()
print(con)

## End(Not run)


nodbi documentation built on Sept. 30, 2024, 1:06 a.m.