datopian / ckanext-aircan

The custom extension for notifying(triggering) the Airflow DAG about the data to be uploaded to DataStore
GNU Affero General Public License v3.0
6 stars 5 forks source link

Raise exception if there is no schema on the resource #16

Closed mbeilin closed 4 years ago

mbeilin commented 4 years ago

We should modify ckanext-aircan to error if there is no schema on the resource.

Acceptance

Tasks

mbeilin commented 4 years ago

Sample request (without schema)

{
  "package_id": "my-first-dataset",
  "url":  "gs://europe-west2-aircan-airflow-1f8e0bdc-bucket/dags/aircan/dags/r3.csv",
  "description": "This is the best resource ever!" ,
  "name": "Hi65"
}

will produce the following response:

{
    "help": "http://ckan:5000/api/3/action/help_show?name=resource_create",
    "success": false,
    "error": {
        "message": "Not found: {'Schema Not Found': 'This resource has no schema so cannot be imported into the DataStore. Please add a Table Schema in the resource schema attribute. See `Airflow instance on Google Composer` section in AirCan docs [https://github.com/datopian/ckanext-aircan#airflow-instance-on-google-composer] for more.'}",
        "__type": "Not Found Error"
    }
}
mbeilin commented 4 years ago

DONE - closed with PR - https://github.com/datopian/ckanext-aircan/pull/18