Python Forum
Python - Netezza cursor function help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python - Netezza cursor function help
#1
Hello friends,

I'm trying to fetch all view defintions defined in a database using Python

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)]

If I use the same query in database I get two SQL queries. Do not know why Python returns 'Not a view' result for some views.
The Database is Netezza.

Value in DEFINITION column is very huge 4000-5000 characters, it's the view definition.

Has anyone faced similar issue before? Look forward to hearing your responses :)

Thanks,
Leo
Reply
#2
What type of dbms?
Reply
#3
DB is Netezza
I'm using pyodbc to connect
Reply
#4
I'm not familiar with that dbms, but I'm sure there must be an admin manager available.
If so, you can use it to go in and look at the system table schema to find out exactly what's
in it.
I use postgreSQL, and sqlite, and in the past have used Oracle extensively, also Informix, Sybase,
and dbase (Alpha actually which was a dbase clone). All had the capability of viwing the schema.

I found this: http://dwgeek.com/netezza-database-schem...hema.html/

If you use this, it should make sense as to why you can't find your views.
Reply
#5
Thanks Larz. I was able to resolve the issue. It was some kind permission issue, the schema that I was using did not have access to view the definition of the view under scope.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 2,216 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  Cursor Variable inside Another Cursor . CX_ORacle paulo79 1 1,481 Apr-09-2022, 10:24 AM
Last Post: ibreeden
  Best way to return Cursor Data rajuarien 0 1,951 Jul-29-2018, 09:47 PM
Last Post: rajuarien

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020