import: Options to set dataset metadata #139
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a
--table-info
option which adds extra dataset metadata via a JSON object. Fixes #102The JSON object is a bit smelly, but I tried hard to think of a better way and couldn't. Because the
import
command now imports multiple tables at once, we need a way to set title, description and xml metadata for multiple layers at once.Some alternatives I tried:
sno import SRC table1 --title=title2 table2 --title=title2
This would probably be the nicest approach in terms of having a flat schema to the command line arguments, though it's a little at odds with how these commands generally work I think.
I couldn't find any simple way to do this in click. It's possible we could abuse multi-command chaining to do it if we tried really hard, but it'd be a hack.
sno import SRC dataset1 dataset2 --dataset1-title title1 --dataset2-title title2
This would work but it once again seems hard to do in click. We'd basically have to give up on the parser and accept everything and handle validation ourselves.
The JSON validates to a schema, so if you do something unexpected, you'll get a verbose but slightly helpful error message:
Related links:
Checklist: