Forum Discussion
Hi @rashmi ,
The execute snap may be able to run all the create statements followed by the select statement. However, it gives the output based on the first query. In your case, its a create statement so it gives the output with success message.
If you have all the create statements first followed by a select statement at the end, then I suggest you to try one of these two approaches:
- Approach1:
a) Use two snaps. The first snap has to be the Execute snap. In this first snap, put only the create statements.
b) The second snap can be an Execute snap with the select statement, or the Select snap itself.
- Approach2:
a) Use a multi-execute snap followed by a Execute/Select snap.
b) Put all the create statements in the multi execute snap.
c) And, use Execute snap with select, or the Select snap itself.
Let me know if this helped.
Hi Smitha,
This should be possible. Try and look at this example and see if you can adapt it to for your needs.
The mapper can be used to conveniently alter binary data before parsing. See the “views” section in the Mapper documentation.
In the attached pipeline, the mapper is using binary views, converting the input data to a string, then replacing the
\r\n
to a space charactercr-example.zip (3.1 KB)
Hi tlikarish,I have tried the approach you have suggested, since as you see in the attached snapshot the record spans over multiple line and there is only CR in one of the columns in between, I have changed the expression to replace -$content.toString().replace(‘\r’, ’ '), by this the records did not get loaded properly, the records was still not considered as single record.
Can you let us know if we need to do something elseThanks
Regards
smitha csvparser.zip (25.5 KB)Are you seeing an error message? Since you’re using quotes and the column is quoted, the CSV Parser should treat the carriage return as part of the column’s value and not as a row delimiter. Is it possible the quoting is off?
Doh – also messed up with the expression I gave you.
$content.toString().replace('\r', ' ')
Only replaces the first match. You should probably use
replaceAll
or change the regular expression to/\r/g
. This will replace all carriage returns, so if the lines are delimited with\r\n
, then you’d have to use something like/\r(?!\n)/g
, which would remove all carriage returns not followed by a line feed.