I recently setup an ArcSDE database in Postgres, and all seemed good. I am able to connect to it from both ArcMap and ArcCatalog, and work with the data as expected. Thus, I know I got the 32-bit Postgres drivers in the correct location and they are working.
However, I've been trying to get a python script running that needs to write to the SDE database. I have been executing the script using the 32-bit python installed with ArcGIS. I made a database connection in a folder available to the script, which I am using to connect to the database. When I run arcpy.Exists on that connection, it returns True, which is good. Except I cannot read or write any data in the database. (Side question: does this mean arcpy.Exists() on a database connection file only checks to see if the connection file exits, and not if the connection is valid/available?)
I setup a simple little test script:
import arcpy import os sde = r"C:\GIS\_SDEConnections\Edituser.sde" print arcpy.Exists(sde) print arcpy.Exists(os.path.join(sde, "AWDB")) # this exists arcpy.env.workspace = sde print arcpy.ListFeatureClasses() # there is one FC in the db print arcpy.ListDatasets() # there are two datasets in the db
And I get:
True False  
However, if I try to execute the script with the 64-bit python installed by the Background Geoprocessor, I can see the data in the database. That is, the test script returns:
True True [u'sde.sde.dd'] [u'sde.sde.AWDB', u'sde.sde.TestFeatures']
So at this point I figured that the problem lies with the 32-bit python. But here's the kicker: if I try to do these same operations in the python command line in ArcCatalog, I do not have any problems. And ArcCatalog is using the 32-bit python, the same python I tried to use initially.
So, does anyone have any ideas as to what could be the problem? I need to stick with the 32-bit python because of some dependencies. Simply using the 64-bit version is not currently an option.
I am using ArcGIS 10.2.2 and PostgreSQL 9.0.8 (I don't administer the server, so this is the Postgres version I'm stuck with for the moment).