O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introspection

Like many SQL databases, Gadfly maintains metadata in tables, and you can query the structure of a Gadfly database:

>>> cursor = connection.cursor()
>>> cursor.execute('SELECT * FROM __table_names__')
>>> print cursor.pp()
IS_VIEW | TABLE_NAME     
=========================
0       | EMPTY          
1       | NONDRINKERS    
1       | ALLDRINKERS    
1       | __INDICES__    
1       | DUAL           
0       | LIKES          
0       | FREQUENTS      
0       | ACCESSES       
0       | WORK           
1       | __TABLE_NAMES__
0       | SERVES         
1       | __DATADEFS__   
1       | __COLUMNS__    
1       | __INDEXCOLS__  
>>>

Apart from the data tables, you can inspect metatables of tables, indexes, and columns in this manner.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required