TableToGeodatabase using MySQL input

3546
1
02-07-2013 10:21 AM
DavidReeves
New Contributor II
I am trying to convert a MySQL table to a personal geodatabase table using TableToGeodatabase and MySQLdb (to connect to the db). I'm able to successfully connect to the database and query it, I am just not able to correctly select the table to be converted. Although I am using an .mdb instead of a .gdb, this does not throw an error. The only error I receive is "ERROR 000735: Input Table: Value is required"

# Import system modules
import arcpy
from arcpy import env
 
import MySQLdb
import sys

# open a database connection
try:
    connection = MySQLdb.connect(host="host.org", user="abcde", passwd="12345", db="waterdb")
    if connection.open:
        print "open"

# Set environment settings
# I believe this should reference the MySQL database but I don't know how
env.workspace = "" 
 
# the table I want to convert
table = arcpy.ListTables(["vwComboFlows"]) 

# Set local variables
outLocation = "C:/output/output.mdb"

try: 
    # Execute TableToGeodatabase
    print "Importing tables to mdb: " + outLocation
    arcpy.TableToGeodatabase_conversion(table, outLocation)
except:
    print arcpy.GetMessages()
Tags (2)
0 Kudos
1 Reply
RichardLaw2
New Contributor II

Hey did you ever resolve this? I'd prefer not to have to use python-mysqldb for this but the process to set up an OLE DB Connection is incredibly onerous and not exposed to ArcPy.

0 Kudos