Skip to contents

Loads a variable from a registered source into PostGIS as attr_X

Usage

loadVariable(connectionDetails, variableSourceId)

Arguments

connectionDetails

(list) An object of class connectionDetails as created by the createConnectionDetails function

variableSourceId

(integer) The identifier for the variable that is registered in the PostGIS variable_source table

Value

A table (attr_X) in PostGIS

Examples

if (FALSE) {

variableSourceId <- 157

variableSourceRecord <- DatabaseConnector::dbGetQuery(conn, paste0("SELECT * FROM backbone.variable_source WHERE variable_source_id = ", variableSourceId))

attrIndex <- DatabaseConnector::dbGetQuery(conn, paste0("SELECT * FROM backbone.attr_index WHERE data_source_id = ", variableSourceRecord$data_source_uuid,";"))

tableExists <- DatabaseConnector::existsTable(conn,
                                              attrIndex$database_schema,
                                              paste0("attr_", attrIndex$table_name))

if (!tableExists) {
  message("Loading attr table dependency")
  loadVariable(conn = conn, connectionDetails = connectionDetails, variableSourceId)
}
}