-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
In app/Meta.py currently, when tables are being added it is only checked to see if the columns present are in the list of accepted columns. For example, see lines 265-296 for the cultivars table. Some of these columns are required and so should return an error if they aren't there.
Lines 265 to 296 in 62702b8
| def insert_cultivars(fileName, status=True): | |
| """ | |
| This function responds to a request for /yaba/v1/cultivars | |
| with csv file | |
| :fileName: CSV file with cultivars meta data | |
| :return: 201 on success | |
| 400 if file is unsuitable or does not contain appropriate columns | |
| 409 Intregrity or Constraint error : 23503 foreign_key_violation | 23505 unique_violation | |
| 500 Database Connection Error | |
| 401 Unauthorized | No user exists | |
| 410 Default error.See logs for more information | |
| """ | |
| try: | |
| data = pd.read_csv(fileName,delimiter = ',') | |
| specie_id=fetch_specie_id(data['species'][0]) | |
| #Checking necessary columns are there. | |
| columns=data.columns.values.tolist() | |
| accepted_columns=['name','species','ecotype','notes'] | |
| if(all(x in accepted_columns for x in columns)): | |
| if status == False: | |
| msg = {'Message' : 'Successfully Validated', | |
| 'Table' : 'Cultivars'} | |
| return make_response(jsonify(msg), 200) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels