Monthly Archives: June 2012

Webservices in Python (or FME?)

Finally – to round off my triple of blog posts here (I’m getting caught up) – I have looked into consuming web services in Python with suds ( It looks straight forward. At this point, the only limitation is my knowledge of web services. Something as simple as:

import suds
from suds.client import Client
url = ''
client = Client(url) 
print client

gets you a description of the service and its methods for this zip code verification service. This just happens to be a free service I could use for testing. One fine day, I hope to figure out how to use this for downloading data from a vendor who provides a wsdl web service portal. In fact, FME may offer a web services reader, too, and I need to take a look at that as well.


Leave a comment

Filed under Uncategorized

Writing to ArcSDE from FME Desktop

I have been doing a lot of simple ETL using FME Desktop, but ran into some problems with writing directly to ArcSDE. So I ended up just writing back to SHP and exporting to SDE from ArcCatalog.

Turns out I was using the wrong writer. Insetad of using the ESRI ArcSDE writer, which writes directly to (in my case) SQL Server but doesn’t utilize ArcObjects, you need to use the ESRI Geodatabase (ArsSDE) writer. Other wise you’re creating tables in your database but they’re not registered with the geodatabase. I figured this out the hard way when my newly created feature classes didn’t show up in ArcCatalog but I could see them in SQL Server Management Studio.

What I like about FME is the simplicity. I’ve read that FME speed outperforms Python scripting. I suppose that’s true. I haven’t run any tests. But when it comes to ESRI geoprocessing, I much prefer FME over the ESRI tools even for simple¬†tasks. Using the a few wildcard characters and merging feature types is a lot easier than having to worry about matching schemas, gp.workspaces, or glob.glob() searches with ESRI Python.

Leave a comment

Filed under Uncategorized

Accessing SQL Server from Python

So, I am working on a Python Programming Certificate and had to spend a bit of time working with MySQL. But I was wishing I could learn how to acess SQL Server from Python. Turns out that’s pretty straight forward:

import pyodbc

server = "myserver"
driver = "SQL Server"
database = "mydatabase"

connStr = "DRIVER={%s};SERVER=%s;DATABASE=%s;Trusted_Connection=yes"%(driver,server,database)
conn = pyodbc.connect(connStr)
dbCursor = conn.cursor
query = "SELECT * FROM sys.tables"
for table in dbCursor:
     print table[0]

That brings up a list of all the table names in mydatabase and prints it to the screen. Time to work more with SQL Server in Python.

You can download pyodbc from

Leave a comment

Filed under Uncategorized