HOW TO
Connecting to PostgreSQL databases from Python provides the ability to run essential SQL queries that can be utilized in geoprocessing tasks.
http://www.stickpeople.com/projects/python/win-psycopg/
import psycopg2
connection = psycopg2.connect(host='prod', database='sde', user='sde', password='sde')
cursor = connection.cursor()
cursor.execute('select * from PARCELS WHERE OBJECTID < 70000')
for query in cursor:
print str(query)
Get help from ArcGIS experts
Download the Esri Support App