Changes between Initial Version and Version 1 of Ticket #2733
- Timestamp:
- 07/30/12 13:48:25 (21 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #2733 – Description
initial v1 8 8 9 9 == What are the initial logic functions? == 10 datastore_create11 datastore_delete12 datastore_show10 * datastore_create 11 * datastore_delete 12 * datastore_show 13 13 14 14 == What is the JSON input format for datastore_create == 15 15 To begin with it can have the following keys. It is fairly consistent with Max Ogdens' gut servers. Except adds resource_id. 16 16 17 {{{ 17 18 { 18 19 20 19 resource_id: resource_id # the data is going to be stored against. 20 fields: a list of dictionaries of fields/columns and their extra metadata. 21 records: a list of dictionaries of the data eg [{"dob": "2005", "some_stuff": ['a', b']}, ..] 21 22 } 23 }}} 22 24 23 25 * The first row will be used to guess types not in the fields and the guessed types will be added to the headers permanently. Consecutive rows have to conform to the field definitions. 24 26 * rows: can be empty so that you can just set the fields 25 27 * fields are optional but needed if you want to do type hinting or add extra information for certain columns or to explicitly define ordering. 26 eg [{"id": "dob", "label": ""Date of Birth", "type": "timestamp" ,"concept": "day"}, {"name": "some_stuff": ..]. A header items values can not be changed after it has been defined nor can the ordering of them be changed. They can be extended though. 28 eg: [{"id": "dob", "type": "timestamp" }, {"id": "some_stuff", "type": "text"}, ...]. 29 A header items values can not be changed after it has been defined nor can the ordering of them be changed. They can be extended though. 27 30 * Any error results in total failure!! For now pass back the actual error. 28 31 * Should be transactional … … 30 33 == What json does datastore_delete take? == 31 34 35 {{{ 32 36 { 33 34 35 e.g {'key1': 'a. 'key2': 'b'} this will be equivalent to "delete from table where key1 = 'a' and key2 = 'b' "37 resource_id: resource_id # the data is going to be deleted. 38 filters: dictionary of matching conditions to delete 39 e.g {'key1': 'a. 'key2': 'b'} this will be equivalent to "delete from table where key1 = 'a' and key2 = 'b' ". 36 40 No filters (either not present or not defined) then delete the table. If we want truncate then add truncate: true to truncate the table. 37 41 } 42 }}} 38 43 39 == What json does datastore_show take? == 44 == What json does datastore_search take? == 45 {{{ 40 46 { 41 42 43 44 45 46 47 48 47 resource_id: resource_id # the data is going to be selected. 48 filters : dictionary of matching conditions to select 49 e.g {'key1': 'a. 'key2': 'b'} this will be equivalent to "select * from table where key1 = 'a' and key2 = 'b' " 50 q: full text query 51 limit: limit the amount of rows to size default 100 52 offset: offset the amount of rows 53 fields: list of fields return in that order, defaults (empty or not present) to all fields in fields order. 54 sort: comma separated field names with ordering e.g "fieldname1, fieldname2 desc" 49 55 } 56 }}} 50 57 51 58 Some free code: https://gist.github.com/3163864 52 59 53 == What json does datastore_s howreturn? ==54 60 == What json does datastore_search return? == 61 {{{ 55 62 { 56 63 fields: same type as datastore_create accepts (i.e. with metadata) 57 64 offset: The same offset that was supplied in datastore_show 58 65 limit: The original limit 59 66 filters: The filters that were applied in data_show 60 total: # total matching records without size or offset ... 61 # list of matching results 62 records: [ same as what data_create takes 63 64 ] 67 total: # total matching records without size or offset 68 records: [same as data_create] # list of matching results 65 69 } 70 }}} 66 71 67 72 On error will return: 68 73 {{{ 69 74 { 70 75 __error__: … sql error … 71 76 } 77 }}} 72 78 73 79 == What types are allowed? == … … 75 81 76 82 http://www.postgresql.org/docs/9.1/static/datatype.html 83 77 84 http://www.postgresql.org/docs/9.1/static/sql-createdomain.html 78 85