-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import data without a primary key #212
Comments
In the simplest case, every feature encountered is just assigned a primary key from the sequence 1, 2, 3... Note that reimporting depends only on the data to be imported and the stored primary key metadata - local edits to For the sake of efficiency, the entire feature is not stored in the mapping, but only a hash of its contents.
In fact the inverse mapping is stored, since it has a simpler structure, primary keys are unique:
This is stored in $DATASET_PATH/meta/generated-pks.json, along with the column-schema of the new primary key:
|
At present it's not possible to import data that doesn't have a primary key. This needs to work somehow so sno can track changes to third-party data effectively.
We already have a
--primary-key
option in theimport
command, for the situation where the data actually does have a unique identifier field and it is just not marked as such. But we need to do better so we can track changes to other data.Naively, a primary key could be a hash of the feature data, plus a sequential integer (to de-duplicate where there are duplicate features.) However a GPKG working copy requires an integer primary key, so GPKG working copies will need to also store a map from the hash-based PK to a working-copy integer PK.
(This ticket to be expanded with a more exact plan)
The text was updated successfully, but these errors were encountered: