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
  Cursor Variable inside Another Cursor . CX_ORacle paulo79 1 656 Apr-09-2022, 10:24 AM
Last Post: ibreeden
  Cursor write 3rd file empty paulo79 3 990 Mar-10-2022, 02:51 PM
Last Post: DeaD_EyE
  change mouse cursor (in Windows) mgroen 0 1,055 Nov-11-2020, 11:26 AM
Last Post: mgroen
  How to avoid slow cursor operations? sevensixtwo 0 1,361 Oct-11-2019, 02:23 PM
Last Post: sevensixtwo
  MySql Cursor field names. MuntyScruntfundle 1 2,045 Oct-22-2018, 04:10 PM
Last Post: nilamo
  Best way to return Cursor Data rajuarien 0 1,534 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