home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 678480969

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/136#issuecomment-678480969 https://api.github.com/repos/simonw/sqlite-utils/issues/136 678480969 MDEyOklzc3VlQ29tbWVudDY3ODQ4MDk2OQ== 9599 2020-08-21T20:33:45Z 2020-08-21T20:33:45Z OWNER I think this should initialize SpatiaLite against the current database if it has not been initialized already. Relevant code: https://github.com/simonw/shapefile-to-sqlite/blob/e754d0747ca2facf9a7433e2d5d15a6a37a9cf6e/shapefile_to_sqlite/utils.py#L112-L126 ```python def init_spatialite(db, lib): db.conn.enable_load_extension(True) db.conn.load_extension(lib) # Initialize SpatiaLite if not yet initialized if "spatial_ref_sys" in db.table_names(): return db.conn.execute("select InitSpatialMetadata(1)") def ensure_table_has_geometry(db, table, table_srid): if "geometry" not in db[table].columns_dict: db.conn.execute( "SELECT AddGeometryColumn(?, 'geometry', ?, 'GEOMETRY', 2);", [table, table_srid], ) ``` Not sure if I should add a utility function or CLI command for that `ensure_table_has_geometry` bit. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 683812642  
Powered by Datasette · Queries took 0.781ms