Description Usage Arguments Details Value See Also Examples
Takes two (or more) Teradata EDW tables using a JDBC connection
object via the RJDBC
package and merges them together.
1 2 |
tdfO |
Name of resulting Teradata to output. |
tdf1 |
Name of first Teradata table to merge. |
tdf2 |
Name of second Teradata table to merge. |
index1 |
Name of index from first table to merge by. |
index2 |
Name of index from second table to merge by. |
col1 |
Name of columns from first table to merge. |
col2 |
Name of columns from second table to merge. |
joinType |
Type of merge to perform. Needs to be one of following: |
... |
Additional |
By default, the code tries to do joins starting from Table 1 going up. So if, for example, three tables are provided for inner joins, then Table 1 and Table 2 will first be inner joined, and the resulting output will then be inner joined with Table 3. If a left join is desired for the three tables, then Table 2 will be left joined to Table 1 and Table 3 will then be left joined with the resulting table.
If desired, column names for each table can be provided to merge together.
By default, the code will try to use all columns of the tables provided.
All tables will be searched for duplicate column names. If any exists,
then copies will be renamed with a suffix of _copyX
where X
represents the number of copies. If an index name merging by has copies
across the tables, then only one index name is kept.
If a connection profile (e.g. username, password, etc.) is provided, then
an attempt is made to connect to Teradata. Once the query is run, the
connection is then closed. If a connection object (conn
) is provided
to the function (or one is found globally), then the connection remains
open.
The code creates the data table on the Teradata server via the
JDBCConnection
object. Names of each table created are returned
as a string vector.
tdConn
for connection, tdDisk
for disk usage,
tdSpool
for spool usage, tdCpu
for CPU
usage, and td
for general queries.
1 2 3 4 5 6 7 8 9 10 | ## NOT RUN ##
## With connection pre-established, inner join on table ##
# conn = tdConn(<username>, <password>)
# tdJoin(<outputTable>, <inputTable1>, <inputTable2>, <index1>, <index2>)
## inner join on table with select columns ##
# tdJoin(<outputTable>, <inputTable1>, <inputTable2>, <index1>, <index2>, joinType="left")
## left join on table ##
# tdJoin(<outputTable>, <inputTable1>, <inputTable2>, <index1>, <index2>, joinType="left")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.