Skip to content

Commit 99ca156

Browse files
committedApr 24, 2020
Version 1.1.1
1 parent 05eb23f commit 99ca156

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
 

‎R_Py-Part_5/R_Py_TechBytes-Part_5-Demo.py

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
# v.1.0 2019-10-29 First release
9191
# v.1.1 2020-04-02 Code simplified with case, sample teradataml funcs.
9292
# Additional information about connections.
93+
# v.1.1.1 2020-04-24 Bug fix: Missing colon in when stmt, and blank line.
9394
# ##############################################################################
9495

9596
# Load teradataml and dependency packages to use in both use cases.
@@ -560,6 +561,7 @@
560561
get_context().execute("DROP TABLE <DBNAME>.MultiModelTest_Py")
561562
except:
562563
pass
564+
563565
copy_to_sql(MultiModelTest_Py, schema_name="<DBNAME>", table_name="MultiModelTest_Py", if_exists = "replace")
564566

565567
###

‎R_Py-Part_5/R_Py_TechBytes-Part_5-Demo.sql

+7-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
-- File Changelog
7575
-- v.1.0 2019-10-29 First release
7676
-- v.1.1 2020-04-02 Added change log; no code changes in present file
77+
-- v.1.1.1 2020-04-24 Bug fix: Column "sampleid" confused with keyword
7778
--------------------------------------------------------------------------------
7879

7980

@@ -179,6 +180,8 @@ DROP TABLE RFStateCodeModelsPy;
179180
--
180181
-- Before you execute the following statement, replace <DBNAME> with the
181182
-- database name you specified in the beginning of Use Case [2] earlier.
183+
-- In the following statement, the "sampleid" column of the input table is
184+
-- enclosed in quotes to differentiate the name from the SQL keyword sampleid.
182185
CREATE TABLE RFStateCodeModelsPy AS (
183186
SELECT d.oc1 AS statecode,
184187
d.oc2 AS rf_model
@@ -189,7 +192,7 @@ CREATE TABLE RFStateCodeModelsPy AS (
189192
ck_acct_ind, sv_acct_ind, cc_acct_ind, ck_avg_bal,
190193
sv_avg_bal, cc_avg_bal, ck_avg_tran_amt, sv_avg_tran_amt,
191194
cc_avg_tran_amt, q1_trans_cnt, q2_trans_cnt,
192-
q3_trans_cnt, q4_trans_cnt, SAMPLE_ID
195+
q3_trans_cnt, q4_trans_cnt, "sampleid"
193196
FROM MultiModelTrain_Py)
194197
PARTITION BY scode
195198
SCRIPT_COMMAND('python3 ./<DBNAME>/stoRFFitMM.py')
@@ -229,6 +232,8 @@ call SYSUIF.install_file('stoRFScoreMM','stoRFScoreMM.py','cz!mmscoscrPATH');
229232
--
230233
-- Before you execute the following statement, replace <DBNAME> with the
231234
-- database name you specified in the beginning of Use Case [2] earlier.
235+
-- In the following statement, the "sampleid" column of the nested input table
236+
-- is enclosed in quotes to differentiate the name from the SQL keyword sampleid.
232237
SELECT d.oc1 AS cust_id,
233238
d.oc2 AS statecode,
234239
d.oc3 AS Prob0,
@@ -243,7 +248,7 @@ FROM SCRIPT( ON(SELECT s.*,
243248
x.ck_acct_ind, x.sv_acct_ind, x.cc_acct_ind, x.ck_avg_bal,
244249
x.sv_avg_bal, x.cc_avg_bal, x.ck_avg_tran_amt, x.sv_avg_tran_amt,
245250
x.cc_avg_tran_amt, x.q1_trans_cnt, x.q2_trans_cnt,
246-
x.q3_trans_cnt, x.q4_trans_cnt, x.SAMPLE_ID,
251+
x.q3_trans_cnt, x.q4_trans_cnt, x."sampleid",
247252
row_number() OVER (PARTITION BY x.cust_id ORDER BY x.cust_id) AS nRow
248253
FROM MultiModelTest_Py x) AS s, RFStateCodeModelsPy m
249254
WHERE s.scode = m.statecode)

0 commit comments

Comments
 (0)
Please sign in to comment.