temp.table.database.name and temp.view.database.name | Teradata Package for R - temp.table.database.name and temp.view.database.name - Teradata Package for R

Teradata® Package for R User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for R
Release Number
17.20
Published
March 2024
Language
English (United States)
Last Update
2024-04-09
dita:mapPath
efv1707506846369.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
nqx1518630623256
Product Category
Teradata Vantage

tdplyr internally creates database objects (tables and views) as required while executing several functions. The temp.table.database.name and temp.view.database.name configurable options allow users to specify database names where tables and views are created, respectively. These two options give users flexibility to specify database names other than the default database to create views and tables.

The td_create_context function provides temp.database and database arguments that also allow user to specify the database name, where database objects can be created. If none of them are specified then the objects are created in users' default database.

All the database objects created by tdplyr are garbage-collected at the end of the session.
While using these options,
  • If the option temp.table.database.name is NULL, then tables are created in the database specified at the time of context creation.
  • If the option temp.view.database.name is NULL, then views are created in the database specified at the time of context creation.
  • Context need not be created when these two configurable options are used.
  • Teradata recommends using these options when following conditions are true, otherwise, use the arguments in the td_create_context() function:
    • When a user has permissions to create tables in one database while views in other database.
    • In case a user wishes to create these temporary objects in a database different than the one specified at the time of context creation. This allows the user to change the database name without re-creating the context.
    • In case a user forgets to use the td_create_context() arguments to set the temp database name, then use these options.

Example

> options("temp.table.database.name" = "tempdb")
> td_glm_out1 <- td_glm_mle(formula = (admitted ~ stats + masters + gpa + programming),
                            family = "LOGISTIC",
                            linkfunction = "LOGIT",
                            data = admissions_train,
                            weights = "1",
                            threshold = 0.01,
                            maxit = 25,
                            step = FALSE,
                            intercept = TRUE
)
 
SQL-MR Query :
 SELECT * FROM GLM (
    ON "ALICE"."admissions_train" as InputTable  
    OUT TABLE OutputTable("tempdb".r__t__td_glm_mle0_1623374476821412)
    USING
    WeightColumn('1')
    Family('LOGISTIC')
    LinkFunction('LOGIT')
    StopThreshold('0.01')
    MaxIterNum('25')
    Intercept('TRUE')
    Step('FALSE')
    InputColumns('admitted','stats','masters','gpa','programming')
    CategoricalColumns('stats','masters','programming')
)  as sqlmr
> td_glm_out1
 
############ coefficients ############
 
# Source:   table<"tempdb"."r__t__td_glm_mle0_1623374476821412"> [?? x 9]
# Database: Teradata
   attribute predictor category estimate std_err z_score p_value significance
       <int> <chr>     <chr>       <dbl>   <dbl>   <dbl>   <dbl> <chr>      
 1         4 masters   yes       NA       NA     NA      NA       NA        
 2         8 programm~ Beginner  -1.77     1.07  -1.66    0.0978 "."        
 3        -1 Loglik    NA       -19.5     40      6       0       NA        
 4         1 stats     Advanced  NA       NA     NA      NA       NA        
 5         5 masters   no         2.22     1.02   2.17    0.0298 "*"        
 6         7 programm~ Advanced  NA       NA     NA      NA       NA        
 7         9 programm~ Novice    -0.980    1.14  -0.860   0.390  " "        
 8         3 stats     Beginner   0.527    1.22   0.431   0.667  " "        
 9         6 gpa       NA        -0.114    0.803 -0.142   0.887  " "        
10         2 stats     Novice     0.0407   1.12   0.0365  0.971  " "        
# ... with more rows, and 1 more variable: family <chr>
 
 
 
############ output ############
 
# Source:   table<"tempdb"."r__t__sqlmr_stdout_1623374477351814"> [?? x 6]
# Database: Teradata
   predictor         estimate std_error z_score p_value significance             
   <chr>                <dbl>     <dbl>   <dbl>   <dbl> <chr>                    
 1 stats.Beginner      0.527      1.22   0.431   0.667  " "                      
 2 gpa                -0.114      0.803 -0.142   0.887  " "                      
 3 programming.Begi~  -1.77       1.07  -1.66    0.0978 "."                      
 4 programming.Novi~  -0.980      1.14  -0.860   0.390  " "                      
 5 ROWS #             40          0      0       0      "Number of rows"         
 6 Residual deviance  38.9        0      0       0      "on 33 degrees of freedom"
 7 Pearson goodness~  37.8        0      0       0      "on 33 degrees of freedom"
 8 ITERATIONS #        4          0      0       0      "Number of Fisher Scoring~
 9 masters.no          2.22       1.02   2.17    0.0298 "*"                      
10 stats.Novice        0.0407     1.12   0.0365  0.971  " "                      
# ... with more rows