Trying to execute below piece of query in python:
try: curs =conn_teradata.cursor() curs.execute('SELECT DATABASE;') print("-----------") curs.execute('CREATE VOLATILE TABLE ZZMD_SET1,NO FALLBACK, NO LOG (FIS_WK_NBR SMALLINT, FIS_YR_NBR INTEGER,MDSE_PRD_KEY INTEGER,SEAS_YR_KEY INTEGER,WJXBFS1 FLOAT,WJXBFS2 FLOAT,WJXBFS3 FLOAT,WJXBFS4 FLOAT,WJXBFS5 FLOAT,WJXBFS6 FLOAT,WJXBFS7 FLOAT,WJXBFS71 FLOAT,WJXBFS8 FLOAT,WJXBFS9 FLOAT,WJXBFSa FLOAT,WJXBFSb FLOAT,WJXBFSc FLOAT) PRIMARY INDEX (FIS_WK_NBR, FIS_YR_NBR, MDSE_PRD_KEY, SEAS_YR_KEY)ON COMMIT PRESERVE ROWS) by teradata') print("-----------") except Exception as e: print(e)
java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.02] [Error 3706] [SQLState 42000] Syntax error: expected something between the 'ROWS' keyword and ')'.
It has been quite sometime trying to figure out the issue but not able to get around. Any help/ suggestion is highly appreciated. Thanks
Why do you have this extra text at the end of the string passed to the execute method? Remove it.
) by teradata
Thank you Fred. At last I had to remove it. But how to keep ") by teradata" and make the query run?
Putting two dashes before it makes it a comment; " --) by teradata".