get_table: Get an arbitrary table from the data warehouse (more...

View source: R/get_table.R

get_tableR Documentation

Get an arbitrary table from the data warehouse (more axccurate if database and schema are given)

Description

Get an arbitrary table from the data warehouse (more axccurate if database and schema are given)

Usage

get_table(.table_name, .server_name, .database_name, .schema, ...)

Arguments

.table_name

the name of a table as a quoted string that you'd like to obtain

.server_name

the name of the server that hosts the database

.database_name

the name of the database which hosts the table

.schema

the name of the schema that hosts the database

...

other arguments passed to get_table (recursively); end user won't typcially use this

Details

This is a workhouse function that provides direct access to any table we have in the warehouse. If the table name uniquely defines that table then the function looks up the server, database, and schema location and you'll get the table back; if more than one table is identified the function will fail informatively, giving you the get_table command to run for every option in the warehouse.

Note well that this function makes at least 2 database calls. The first is to look up the table location and then second to get your data. This means that it will run slower than other ⁠get_*⁠ functions in this package the don't make the first call: those tables' locations are looked up on a static dateframe.

Value

a ⁠tbl_sql SQL Server⁠ object (or Null if there is not unique table in the warehouse)

Examples

## Not run: 
# This won't return a table, but instead an informative error show all `Students`
# tables (20 as of this writing) in the warehouse
# The warning provides code that can be copied and pasted to get a given table.
students <- get_tables("Students")

# Trying again with a specific table in specific schema in a specific database
  get_table(.table_name = "Students",
            .database_name = "PROD1",
            .schema = "Schools")

# And here's an example

## End(Not run)


idea-analytics/ideadata documentation built on Feb. 1, 2024, 5:40 a.m.