josephramsay / lds_replicate

Replication scripts for LDS (LINZ Data Service).
http://data.linz.govt.nz/
2 stars 1 forks source link

Error calling layer.SetAttributeFilter #14

Open josephramsay opened 11 years ago

josephramsay commented 11 years ago

Since accessing layers by name rather than id, DataStore line 1027 throws a "no COPY in progress' error when setting attribute filter more than once using Postgres driver. PG_USE_COPY = "NO"|"YES" makes no difference.

--------->8---------

SET Attr FLT = id = '180287' SET Attr FLT = id = '824646' Traceback (most recent call last): File "/home/jramsay/git/LDS/LDSReplicate/lds/gui/LDSGUI.py", line 408, in doReplicateClickAction self.runReplicationScript(params,'Replicate') File "/home/jramsay/git/LDS/LDSReplicate/lds/gui/LDSGUI.py", line 457, in runReplicationScript tp.processLDS(tp.initDestination(destination_driver)) File "/home/jramsay/git/LDS/LDSReplicate/lds/TransferProcessor.py", line 323, in processLDS self.replicateLayer(each_layer, pk)
File "/home/jramsay/git/LDS/LDSReplicate/lds/TransferProcessor.py", line 342, in replicateLayer self.dst.write(self.src, self.dst.getURI(), self.getSixtyFour(layer_i)) File "/home/jramsay/git/LDS/LDSReplicate/lds/DataStore.py", line 297, in write self.featureCopyIncremental(self.src_link.ds,self.ds,self.src_link.CHANGE_COL) File "/home/jramsay/git/LDS/LDSReplicate/lds/DataStore.py", line 525, in featureCopyIncremental e = self.updateFeature(dst_layer,src_feat,new_feat_def,layerconfentry.pkey) File "/home/jramsay/git/LDS/LDSReplicate/lds/DataStore.py", line 620, in updateFeature dst_fid = self._findMatchingFID(dst_layer, ref_pkey, src_pkey) File "/home/jramsay/git/LDS/LDSReplicate/lds/DataStore.py", line 1004, in _findMatchingFID newf = self._findMatchingFeature(search_layer,ref_pkey,key_val) File "/home/jramsay/git/LDS/LDSReplicate/lds/DataStore.py", line 1027, in _findMatchingFeature search_layer.SetAttributeFilter(qry) File "/usr/share/pyshared/osgeo/ogr.py", line 964, in SetAttributeFilter return _ogr.Layer_SetAttributeFilter(self, *args) RuntimeError: no COPY in progress