-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add dataset api support #32
Conversation
per #21 (comment), I would also like to add three "higher-level" functions to |
@click.option('--input', '-i', default='-', | ||
help="File containing features to insert, update, and/or delete") | ||
@click.pass_context | ||
def delete_feature(ctx, dataset, puts, deletes, input): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/delete_feature/batch_update_feature/
@rclark This looks greats. A few questions
The higher-level commands, chunked writing and geojson feature streaming are something we should definitely keep on the radar. For now though, I'm happy with the current implementation as a first cut. |
I agree that the batch update interface is a little confusing, but I'm inclined to keep it because it is a mirror image of the actual API endpoint. In the higher-ground branch I outlined distinct put-features and delete-features methods which might be more clear and more amenable to streaming from other geojson sources. 👍 to rolling those new methods separately in the near future, perhaps as soon as mapbox/cligj#9 lands and we're in a better place to stream geojson through. I'm missing something here about order of subcommands. Do you mean that you don't like the fact that 👍 I'll rename to datasets. I think I was thrown by the singular |
re: ordering, i was just noting that in your original comment, the command order makes sense, going from service level methods, to dataset methods, to feature methods.
But
It might just be a matter of configuring click to change the ordering but I'm not sure that option exits (haven't found it in the click docs). It's ultimately not a big deal and I could see that some people might actually prefer this ordering. Good catch on the |
.... actually... maybe we shouldn't.
|
Good point, at the sdk it make sense to mirror the API as closely as possible. But maybe we start diverging from the naming at the CLI where it makes sense. I like the idea of making subcommands more verb-like (geocode instead of geocoding) but it doesn't fit every service. I dunno, I suck at naming things, carry on... |
Naming is hard, for sure. I'd love to get a more unix-y feel to the commands – Here's a possibility: break up the mapbox-datasets command into mapbox-datasets (list and create), mapbox-dataset (read, update, delete), mapbox-features (list and batch update), and mapbox-feature (read, update, delete). Would solve the order issue at the same time. |
@rclark We should also document the datasets functionality - aka copy and paste the help into the README. |
Slapped the docs into readme. How about we merge this? I'm excited to get it integrated with #34 |
@rclark I'm going to give feature access one more test drive and will merge in ~1 hour. The package is otherwise (change log etc) ready for a release. |
if res.status_code != 204: | ||
raise MapboxCLIException(res.text.strip()) | ||
|
||
@datasets.command(name="batch-update-feature", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name="batch-update-features"
plural.
Adds basic dataset api support:
The only deviation from the sdk was naming
put-feature
rather thanupdate-feature
. It seems a little confusing to me to have a method calledupdate-feature
where the first line of documentation says, "Insert or update".Also implements
mapbox dataset create-tileset
which is anuploads.create
call in disguise.cc @perrygeo @sgillies for any further tips on writing python code!
refs #21