dtreeves

TableToGeodatabase using MySQL input

Discussion created by dtreeves on Feb 7, 2013
Latest reply on Apr 9, 2015 by richard.law
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()

Outcomes