create_main_joint_tables: Create Main Joint Tables

Description Usage Arguments Examples

View source: R/CreateMainJointTables.R

Description

Get a list of all the Main tables in the database joined with all their relationships with only Include == TRUE columns

Usage

1
2
3
4
5
6
7
8
create_main_joint_tables(
  db_fields,
  db_forced_rel,
  con = db$con,
  DeselectKeysIfIncludeFalse = TRUE,
  Verbose = TRUE,
  get_sql_query = TRUE
)

Arguments

db_fields

A DF with columns: "Include, KeyType, Table, Column, Type, RelationshipWithTable, RelationshipWithColumn, Transformation, Comment" about the User Selected fields and Relationships

db_forced_rel

A Named String Vector. The vector names MUST point to the main table to be used for the 1-Joint-Table as its LHS

con

A dbConnect DBI connection object to a SQL Database

DeselectKeysIfIncludeFalse

A Boolean. Must be FALSE if we need to continue to 1-Joint-Table, otherwise needed Identity and Foreign keys might be missing

Verbose

A Boolean. Verbose = TRUE will output the consecutive joins as they happen

get_sql_query

A Boolean. get_sql_query = TRUE will create/edit the db$sql_main_joint_tables that output the SQL Code for the tables

Examples

1
2
3
4
5
main_joint_tables <-
  create_main_joint_tables(db_fields, c(Hours_SiteID = "Site_SiteID", Hours_EmployeeID = "Employee_ID"), FALSE, db$con) %>%

print(main_joint_tables)
All the Main Tables (tables with foreign keys) are joined with their relationships and are returned as a list of tibbles (n = number of tables with foreign keys that also contain User Selected fields)

N1h1l1sT/dbautojoinr documentation built on Jan. 24, 2021, 10:15 a.m.