dbCreatePartBoundTableEM: Create a PostgreSQL Partitioned and/or Bounded Table

Description Usage Arguments Details Examples

View source: R/AmerAssocIndividInvestorsAAII.R

Description

Exposes an interface to simple PostgreSQL 'CREATE TABLE . . . PARTITION BY . . . PARTITION OF . . . FOR VALUES . . . ' commands.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
dbCreatePartBoundTableEM(
  connName,
  name,
  temporary = FALSE,
  if.not.exists = FALSE,
  like.name = character(),
  like.name.defaults = FALSE,
  like.name.constraints = FALSE,
  fields = character(),
  part.by = character(),
  part.bound = character(),
  part.key.def = character(),
  env,
  display = TRUE,
  exec = TRUE
)

Arguments

connName

String. Default is "connEM". Contains the name of the variable that contains the name of the "connection" in the environment "env".

name

Name of the table. Escaped with.

temporary

If 'TRUE', will generate a temporary table statement.

if.not.exists

Logical. Default is FALSE. If TRUE, add the " IF NOT EXISTS " clause.

like.name

Create a table like this one. If this has a name, then all other parameters are ignored EXCEPT "like.name.defaults" and "like.name.constraints".

like.name.defaults

Logical. Default is FALSE. This is an option only when "like.name" has a value.

like.name.constraints

Logical. Default is FALSE. This is an option only when "like.name" has a value. [DBI::dbQuoteIdentifier()].

fields

Either a character vector or a data frame.

A named character vector: Names are column names, values are types. Names are escaped with [DBI::dbQuoteIdentifier()]. Field types are unescaped.

A data frame: field types are generated using [DBI::dbDataType()].

part.by

String. 'PARTITION OF parent_table'

part.bound

String. '[ ( column_name [ WITH OPTIONS ] [ column_constraint [ ... ] ] | table_constraint [, ... ] ) ] FOR VALUES partition_bound_spec | DEFAULT '.

part.key.def

String. '[ PARTITION BY RANGE | LIST | HASH ( column_name | ( expression ) [ COLLATE collation ] [ opclass ] [, ... ] ) ]'.

env

Environment. Default is the .Global environment. This is the environment to return the connection object "connEM".

display

Logical. Whether to display the query (defaults to TRUE).

exec

Logical. Whether to execute the query (defaults to TRUE).

Details

This code is partially inspired by R CRAN package DBI S4 methods sqlCreateTable and dbCreateTable.

NOTE: In PostgreSQL, one can not convert a table to a partitioned table and vice-versa.

Examples

1
2
3
4
## Not run: 
dbCreatePartBoundTableEM(name = "mtcars", part.key.def = "LIST(CAST(gear AS INTEGER))")

## End(Not run)

AndreMikulec/econModel documentation built on June 30, 2021, 9:48 a.m.