Closed raychew13 closed 8 years ago
Good call, fix will be released shortly.
Thanks, -Eric
Thanks for fixing this Eric,
I've found another issue in the bteqplit().
If the bteq scirpt contains below sql statement, BTEQ script is not returning a valid statement.
Bad Example REPLACE VIEW MY_DB.MY_CUSTOM_VIEW AS LOCKING ROW FOR ACCESS -- this is my dummy comment; SELECT source_table.column_one,source_table.column_two FROM MY_DB.MY_TABLE_ONE source_table;
The statement stopped at comment line because of the below code in bteqsplit() function. Below logic is not valid if the line is a comment line. if line.endswith(";"):
Let me know if you want me to raise a new bug ticket.
Cheers, Ray
A list of statements can be retrieved from BTEQ files using, teradata.BteqScripts("my_test_script.bteq"). This interface is quite useful if you want to execute the bteq script at statement level so that you can save the checkpoint for each statement execution. Since you are saving the checkpoint at the statement level, if the bteq executions is failed, you can rerun the same bteq files from the point of failure.
The issue that I have is when a bteq file contains multil line comment style in a single line, teradata.BteqScripts cannot retrieve all statements from the Bteq files.
Below is a good and bad example. In example 2, when database developer enter the multi-line comment in a single line, teradata.BteqScripts is not returning all the statements. The bug fix for this seems straight forward, You just need to change to logic in the bteqsplit function in the util.py. Add another else if statement to work out the flag of inComment before elif line.startswith("/"):.
Good_Example.bteq (Example 1)
select * from tableA; / my multi line comment / select * from tableB;
Issue_with_multiline_Example.bteq (Example 2)
select * from tableA; /* my multi line comment is specified in single line / select \ from tableB;
Regards, Ray Chew