kettle_anonymous
06-07-2006, 08:01 AM
Hello:
I am attempting to run a SQL query, that extracts/calculates/combines data from several tables and insert this result set into a reporting datamart.
The set-up is Spoon running against a My-Sql Database. The My-Sql driver I am using is: mysql-connector-java-5.0.0-beta-bin.jar.
The Spoon set has three steps:
Step 1: Calcluate Date Range For Yesterday (Get System Info Step)
Step 2: Get CMP Data (Table Input Step)
Step 3: Insert CMP Data into Reporting Database (Table Output Step)
In Step 2 the query I am attempting to run is:
SELECT IF(sec.nickname not like 'site%' or sec.nickname is null, 'site-Alpha', sec.nickname) AS 'section', msa.time_opened, u.email, u.first_name, u.last_name, SEC_TO_TIME(UNIX_TIMESTAMP(MAX(cs.time_started))-UNIX_TIMESTAMP(MIN(msa.time_opened))) AS 'elapsed_time',
COUNT(DISTINCT cr.time_requested) AS 'pages'
FROM users u,
sessions s,
meme_space_activations msa
LEFT JOIN content_retrievals cr ON msa.id = cr.meme_space_activation_id
LEFT JOIN content_searches cs ON msa.id = cs.meme_space_activation_id
LEFT JOIN sections sec ON msa.meme_space_id = sec.meme_space_id
WHERE msa.session_id = s.id
AND u.id = s.user_id
AND msa.time_opened > ?
AND msa.time_opened < ?
GROUP BY s.id, msa.time_opened
ORDER BY 1 ASC, 2 ASC, 5 ASC;
Using Spoon, I have set up a Table Input step. The output of this query has "null" fields. The AS 'section' is not setting the field value correctly.
Any help is appreciated.
Chanu
I am attempting to run a SQL query, that extracts/calculates/combines data from several tables and insert this result set into a reporting datamart.
The set-up is Spoon running against a My-Sql Database. The My-Sql driver I am using is: mysql-connector-java-5.0.0-beta-bin.jar.
The Spoon set has three steps:
Step 1: Calcluate Date Range For Yesterday (Get System Info Step)
Step 2: Get CMP Data (Table Input Step)
Step 3: Insert CMP Data into Reporting Database (Table Output Step)
In Step 2 the query I am attempting to run is:
SELECT IF(sec.nickname not like 'site%' or sec.nickname is null, 'site-Alpha', sec.nickname) AS 'section', msa.time_opened, u.email, u.first_name, u.last_name, SEC_TO_TIME(UNIX_TIMESTAMP(MAX(cs.time_started))-UNIX_TIMESTAMP(MIN(msa.time_opened))) AS 'elapsed_time',
COUNT(DISTINCT cr.time_requested) AS 'pages'
FROM users u,
sessions s,
meme_space_activations msa
LEFT JOIN content_retrievals cr ON msa.id = cr.meme_space_activation_id
LEFT JOIN content_searches cs ON msa.id = cs.meme_space_activation_id
LEFT JOIN sections sec ON msa.meme_space_id = sec.meme_space_id
WHERE msa.session_id = s.id
AND u.id = s.user_id
AND msa.time_opened > ?
AND msa.time_opened < ?
GROUP BY s.id, msa.time_opened
ORDER BY 1 ASC, 2 ASC, 5 ASC;
Using Spoon, I have set up a Table Input step. The output of this query has "null" fields. The AS 'section' is not setting the field value correctly.
Any help is appreciated.
Chanu