mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-28 21:04:13 +02:00
Use db.execute instead of db.conn.execute
This commit is contained in:
parent
7d9473809f
commit
653350a551
1 changed files with 3 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ def init_spatialite(db: Database, path: str) -> None:
|
||||||
# Initialize SpatiaLite if not yet initialized
|
# Initialize SpatiaLite if not yet initialized
|
||||||
if "spatial_ref_sys" in db.table_names():
|
if "spatial_ref_sys" in db.table_names():
|
||||||
return
|
return
|
||||||
db.conn.execute("select InitSpatialMetadata(1)")
|
db.execute("select InitSpatialMetadata(1)")
|
||||||
|
|
||||||
|
|
||||||
def add_geometry_column(
|
def add_geometry_column(
|
||||||
|
|
@ -33,7 +33,7 @@ def add_geometry_column(
|
||||||
not_null: bool = False,
|
not_null: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"Add a geometry column to a table"
|
"Add a geometry column to a table"
|
||||||
table.db.conn.execute(
|
table.db.execute(
|
||||||
"SELECT AddGeometryColumn(?, ?, ?, ?, ?, ?);",
|
"SELECT AddGeometryColumn(?, ?, ?, ?, ?, ?);",
|
||||||
[table.name, column_name, srid, geometry_type, coord_dimension, int(not_null)],
|
[table.name, column_name, srid, geometry_type, coord_dimension, int(not_null)],
|
||||||
)
|
)
|
||||||
|
|
@ -41,4 +41,4 @@ def add_geometry_column(
|
||||||
|
|
||||||
def create_spatial_index(table: Table, column_name: str = "geometry") -> None:
|
def create_spatial_index(table: Table, column_name: str = "geometry") -> None:
|
||||||
"Create a spatial index for a table and column"
|
"Create a spatial index for a table and column"
|
||||||
table.db.conn.execute("select CreateSpatialIndex(?, ?)", [table.name, column_name])
|
table.db.execute("select CreateSpatialIndex(?, ?)", [table.name, column_name])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue