issues fetching data from Netezza using Pyodbc

27 views
Skip to first unread message

leoj...@gmail.com

unread,
Jan 5, 2018, 7:54:54 AM1/5/18
to pyodbc

Hello friends,


I'm trying to fetch all view definitions defined in a Netezza database using Python ; pyodbc is used to connect to Netezza


Python code snippet:

query="SELECT DEFINITION FROM DATABSE1.._V_VIEW WHERE database='DATABASE1' and VIEWNAME in ('VIEW1','VIEW2')" 
cur.execute(query) 
defintion=cur.fetchall() 
print (defintion) 

I'm getting below result : [('Not a view', ), ('SELECT * FROM TABLE1)]


expected result : [('SELECT * FROM TABLE2', ), ('SELECT * FROM TABLE1)]


The query is working fine when run directly in database. DEFINITION field is NVARCHAR


Do not know why Python returns 'Not a view' result for some views. 

Value in DEFINITION column is very huge 4000-5000 characters,content is "SELECT" statement. Has anyone faced similar issue before? Look forward to hearing your responses :)

Thanks, 

Leo


Reply all
Reply to author
Forward
0 new messages