add_index | R Documentation |
add_index
adds an index to a SQL table using specified variables or a YAML config file.
add_index(
conn,
server = NULL,
config = NULL,
config_url = NULL,
config_file = NULL,
to_schema = NULL,
to_table = NULL,
index_type = NULL,
index_name = NULL,
index_vars = NULL,
drop_index = T,
test_schema = NULL
)
conn |
SQL server connection created using |
server |
Name of server being used (only applies if using a YAML file). Useful if the same table is loaded to multiple servers but with different names or schema. |
config |
Name of object in global environment that contains configuration
information. Use one of |
config_url |
URL of a YAML config file. Use one of |
config_file |
File path of a YAML config file. Use one of |
to_schema |
Name of the schema to apply the index to (if not using YAML input). |
to_table |
Name of the table to apply the index to (if not using YAML input). |
index_type |
Which index type will be used, either 'ccs' or 'cl' (if not using YAML input). |
index_name |
Name of the index to be added (if not using YAML input). |
index_vars |
Vector of variables to index on if using a clustered ('cl') index (if not using YAML input). Should take the format c("a", "b", "c"). |
drop_index |
Remove any existing clustered or clustered column store indices. Default is TRUE. |
test_schema |
Add index to a temporary/development schema when testing out table creation. Will use the to_schema (specified or in the YAML file) to make a new table name of {to_schema}_{to_table}. Schema must already exist in the database. Most useful when the user has an existing YAML file and does not want to overwrite it. Default is NULL. |
This function adds a clustered column store (CCS) or clustered (CL) index to a SQL table using specified variables or a YAML configuration file. Users can specify some input functions (e.g., to_table) and rely on the config file for the rest of the necessary information. For all arguments that could be specified or come from a YAML file, the hierarchy is specified > argument under server in YAML > argument not under server in YAML.
(Assume the indentation is appropriate)
to_schema: raw to_table: mcaid_elig *optional other components like a qa_schema and qa_table, variables, etc.* index_type: ccs index_name: idx_ccs_raw_mcaid_elig
(Assume the indentation is appropriate)
phclaims: to_schema: raw to_table: mcaid_elig hhsaw: to_schema: raw to_table: mcaid_elig *optional other components like a qa_schema and qa_table, variables, etc.* index_type: cl index_name: idx_raw_mcaid_elig_id_date index_vars: - id_apde - start_date
## Not run:
add_index(conn = db_claims, server = "hhsaw", config = load_config)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.