python - Posting a list to a web2py database -


i have simple web2py app implements restful api. in model, have like:

db.define_table('vehicles',                 field('flightid', type='string', default='00000', length=128,                  .                 .                 .                 field('route', 'reference path'),                 )  db.define_table('path',                 field('coordinates', type='list:integer', requires=is_not_empty())) 

i want vehicle able reference path, managed database entry. path, of course, given coordinate pairs in latitude/longitude list of tuples best. there more sensible way this? how post list of ints? use requests this?

the client needs able query vehicle lot, not send full path each time happens there many points along path. i'm totally out of element web stuff, appreciate help, tips or resources can provide in regard.

i don't see how store sequence of latitude/longitude pairs in list:integer field. instead, might consider following options:

  1. make db.path.coordinates json field, , submit coordinates json object. when retrieving records table, web2py dal automatically convert json python object manipulation python.
  2. use string or text field , create own custom serialization of data string format, parsing data when doing inserts , selects.
  3. implement option #2 using either filter_in/filter_out or custom field type.

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -