modifyFeatures may be useful, but it won't add new features, and it
doesn't report back if something changed. In terms of effect, it's
equivalent to the SQL 'update table foo set colA = bar where colB =
baz'.
As you say, I don't believe the geotools API supports upsert. The
equivalent would be something like:
val updater = ds.getFeatureWriter(typeName, filter,
Transaction.AUTO_COMMIT)
if (updater.hasNext) {
// modify update feature
} else {
val appender = ds.getFeatureWriterAppend(typeName,
Transaction.AUTO_COMMIT)
// add to appender
}
If doing batches, you could keep a reference to the appender instead
of creating one each time.
Any implementation we added would essentially be a convenience
wrapper around that. I don't believe there are any major
optimizations we could make, so I'm not sure it's worthwhile to do
something outside the geotools API unless a lot of people want it.
Thanks,
Emilio
On 01/22/2018 10:58 AM, Jim Hughes
wrote:
Hi Jason,
In terms of implementation, upserts would end up being a delete
followed by an insert. I think the GeoTools DataStore API does
have a modifyFeatures call which may provide some of the
convenience you are looking for here.
Cheers,
Jim
On 01/18/2018 02:59 PM, Jason Koh wrote:
Hi,
I wonder if Geomesa is going to have the upsert feature. I
want to update the value of a certain query if the query
pattern exists, else insert. Geotools seems not supporting
this though. I understand it doesn't have to be prioritized,
but just curious.
Thanks!
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geomesa-users
|