home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 1030732909

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/sqlite-utils/issues/399#issuecomment-1030732909 https://api.github.com/repos/simonw/sqlite-utils/issues/399 1030732909 IC_kwDOCGYnMM49b7xt 9599 2022-02-06T01:47:06Z 2022-02-06T01:47:06Z OWNER Here's an idea for an API design: ```python geojson_geometry = {} # ... GeoJSON goes here db["places"].insert( {"name": "Wales", "geometry": geojson_geometry}, geojson="geometry" ) ``` That `geojson=` parameter takes either a single column name or an iterable of column names. Any column in that list is expected to be a compatible `geometry` and the correct conversion functions will be applied. That solves for GeoJSON, but it's a bit ugly. Should I add `wkt=` and maybe even `kml=` and `gml=` and so-on too? Definitely not, that's way too many ugly and inscrutable new parameters. More importantly: if I want to support the following how would I do it? ```python db["places"].insert( {"name": "London", "point": (51.509865, -0.118092)} ) ``` Here I want to provide a `(latitude, longitude)` pair and have it inserted correctly into a `point` column. Could do this, but again it's messy: ```python db["places"].insert( {"name": "London", "point": (51.509865, -0.118092)}, point="point" ) ``` And again, what about those `(longitude, latitude)` people? {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 1124731464  
Powered by Datasette · Queries took 0.961ms