Changes between Initial Version and Version 1 of Ticket #2733


Ignore:
Timestamp:
07/30/12 13:48:25 (21 months ago)
Author:
johnglover
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2733 – Description

    initial v1  
    88 
    99== What are the initial logic functions? == 
    10 datastore_create 
    11 datastore_delete 
    12 datastore_show 
     10 * datastore_create 
     11 * datastore_delete 
     12 * datastore_show 
    1313 
    1414== What is the JSON input format for datastore_create == 
    1515To begin with it can have the following keys. It is fairly consistent with Max Ogdens' gut servers.  Except adds resource_id. 
    1616 
     17{{{ 
    1718{ 
    18         resource_id: resource_id # the data is going to be stored against. 
    19         fields: a list of dictionaries of fields/columns and their extra metadata. 
    20         records: a list of dictionaries of the data eg  [{"dob": "2005", "some_stuff": ['a', b']}, ..] 
     19resource_id: resource_id # the data is going to be stored against. 
     20fields: a list of dictionaries of fields/columns and their extra metadata. 
     21records: a list of dictionaries of the data eg  [{"dob": "2005", "some_stuff": ['a', b']}, ..] 
    2122} 
     23}}} 
    2224 
    2325 * 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. 
    2426 * rows: can be empty so that you can just set the fields 
    2527 * 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. 
     28eg:  [{"id": "dob", "type": "timestamp" }, {"id": "some_stuff", "type": "text"},  ...]. 
     29A 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. 
    2730 * Any error results in total failure!! For now pass back the actual error. 
    2831 * Should be transactional 
     
    3033== What json does datastore_delete take? == 
    3134 
     35{{{ 
    3236{ 
    33     resource_id: resource_id # the data is going to be deleted. 
    34     filters: dictionary of matching conditions to delete 
    35         e.g  {'key1': 'a. 'key2': 'b'}  this will be equivalent to "delete from table where key1 = 'a' and key2 = 'b' " 
     37resource_id: resource_id # the data is going to be deleted. 
     38filters: 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' ". 
    3640    No filters (either not present or not defined) then delete the table. If we want truncate then add truncate: true to truncate the table. 
    3741} 
     42}}} 
    3843 
    39 == What json does datastore_show take? == 
     44== What json does datastore_search take? == 
     45{{{ 
    4046{ 
    41         resource_id: resource_id # the data is going to be selected. 
    42         filters : dictionary of matching conditions to select 
    43         e.g  {'key1': 'a. 'key2': 'b'}  this will be equivalent to "select * from table where key1 = 'a' and key2 = 'b' " 
    44         q: full text query 
    45         limit: limit the amount of rows to size default 100 
    46         offset: offset the amount of rows 
    47         fields:  list of fields return in that order, defaults (empty or not present) to all fields in fields order. 
    48         sort: comma separated field names with ordering e.g "fieldname1, fieldname2 desc" 
     47resource_id: resource_id # the data is going to be selected. 
     48filters : 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' " 
     50q: full text query 
     51limit: limit the amount of rows to size default 100 
     52offset: offset the amount of rows 
     53fields:  list of fields return in that order, defaults (empty or not present) to all fields in fields order. 
     54sort: comma separated field names with ordering e.g "fieldname1, fieldname2 desc" 
    4955} 
     56}}} 
    5057 
    5158Some free code: https://gist.github.com/3163864 
    5259 
    53 == What json does datastore_show return? == 
    54  
     60== What json does datastore_search return? == 
     61{{{ 
    5562{ 
    56         fields: same type as datastore_create accepts (i.e. with metadata) 
     63fields: same type as datastore_create accepts (i.e. with metadata) 
    5764offset: The same offset that was supplied in datastore_show 
    5865limit: The original limit 
    5966filters: 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         ] 
     67total: # total matching records without size or offset 
     68records: [same as data_create] # list of matching results 
    6569} 
     70}}} 
    6671 
    6772On error will return: 
    68  
     73{{{ 
    6974{ 
    70         __error__: … sql error … 
     75__error__: … sql error … 
    7176} 
     77}}} 
    7278 
    7379== What types are allowed? == 
     
    7581 
    7682http://www.postgresql.org/docs/9.1/static/datatype.html 
     83 
    7784http://www.postgresql.org/docs/9.1/static/sql-createdomain.html  
    7885