Giter Site home page Giter Site logo

example-add-dataset's Introduction

example-add-dataset

Example script that uses the CKAN API to create a dataset and upload some files to it (By default to a CKAN instance running on http://localhost:5000).

Requires ckanapi and requests.

Usage:

$ python add_example_datasets.py API-KEY

Originally written by @seanh

example-add-dataset's People

Contributors

amercader avatar johnjohndoe avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

example-add-dataset's Issues

Only Works on *Public* Datasets/Packages

There should be a mention in the README, or somewhere else like the documentation for package_show, that this only works for datasets (aka packages) that have been made public. package_show will only return public datasets, therefore if you attempt to use this script to upload files to a private dataset, it fails with a message that it can't find the dataset.

It would be very helpful if there were at least a mention of that somewhere. If that is tied to a config setting somewhere that we've set for datasets on our CKAN instance, that also could be very good to make users aware of.

Running this against a 2.3 installation is failing with solr error

@amercader
I know this example is slightly dated, but it's useful to test the new resource view formats.
I upgraded from a 2.2 to a 2.3 installation ...
I'm using the ckan/ckan-docker implementation and ended up having to copy across the 2.3 schema manually to the solr container ...
Any idea why I'm getting this "multiple values encountered for non multiValued field", when the API is being used to push multiple files at once?

Thanks.

python add_example_datasets.py
Creating "Data viewer examples" package
Creating "Example GEOJSON file" resource
Creating "Example JPG file" resource
Error while creating resource: {"help": "http://127.0.0.1/api/3/action/help_show?name=resource_create", "success": false, "error": {"message": "Unable to add package to search index: Solr returned an error: 400 Bad Request - \n\n<lst name="responseHeader"><int name="status">400<int name="QTime">1<lst name="error"><str name="msg">ERROR: [doc=16243cb72e616125ec9797151b9b1c2c] multiple values encountered for non multiValued field res_name: [Example GEOJSON file, Example JPG file]<int name="code">400\n\n", "__type": "Search Index Error"}}

2.6 - KeyError: 'name' on error handling,

When a validation error occurs, I am getting...

Traceback (most recent call last):
File "ckan_populater.py", line 42, in
e.error_dict['name'] == ['That URL is already in use.']):
KeyError: 'name'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.