chrisjcantire

selecting with sqlite?

Discussion created by chrisjcantire on Apr 5, 2013
Latest reply on Apr 5, 2013 by chrisjcantire
hi all; apologies if this has been answered already elsewhere, please point me in that direction if so...

python novice here, and learning arcgis after having come from a mapinfo background....

I would like to, in arc 9.3 (alas not 10), use sql to select some records from a table, in order etc. here is my python so far:

from easygui import *
import arcgisscripting
import re
import dbfpy
from dbfpy import dbf
import sqlite3
import os

# create the geoprocessor object
gp = arcgisscripting.create(9.3)

inWorkspace = enterbox(msg="please enter your working directory",title="working directory")
layer1 = fileopenbox(default=inWorkspace+"\*.shp")
layer2 = fileopenbox(default=inWorkspace+"\*.shp")

print layer1
print layer2
print inWorkspace

gp.workspace = inWorkspace
# process
gp.PointDistance_analysis(layer1,layer2,"temp.dbf","#")

gp.Rename_management("temp.dbf", "output.dbf")

db = dbf.Dbf(gp.workspace+"\output.dbf")

records = db.sql("select * where distance > 0.6")

...this last line is where I'm stuck of course ('distance' is a valid column in the dbf); syntax for using sql on a dbf I've just made??? I'm so used to just using plain old sql in the command line in mapinfo, but of course esri must have a similar tool, just a matter of figuring it out...

thanks all,

cj

Outcomes