Summary
Creates an SQLite database or GeoPackage.
Syntax
CreateSQLiteDatabase (sqlite_database_path, {spatial_type})
Parameter | Explanation | Data Type |
sqlite_database_path | Location of the SQLite database to be created and the name of the SQLite database file. You must include the .sqlite extension in the database file name if creating a SQLite database that uses a spatial type of ST_Geometry or SpatiaLite. When creating a GeoPackage, a .gpkg extension is required. | String |
spatial_type | The geometry type to install with the new SQLite database. You can use only one geometry type in SQLite databases.
| String |
Return Value
Data Type | Explanation |
File | An SQLite database (.sqlite extension) with either ST_Geometry or SpatiaLite geometry type installed. Alternately, a GeoPackage is returned (.gpkg extension). |
Code sample
CreateSQLiteDatabase ST_Geometry example 1
Create an SQLite database.
import arcpy
# Set local variables
sqlite_database_path = 'C:/Data/Counties.sqlite'
# Execute CreateSQLiteDatabase
arcpy.gp.CreateSQLiteDatabase(sqlite_database_path, "ST_GEOMETRY")
CreateSQLiteDatabase GeoPackage example 2
Create a GeoPackage.
import arcpy
# Set local variables
sqlite_database_path = 'C:/Data/Counties.gpkg'
# Execute CreateSQLiteDatabase
arcpy.gp.CreateSQLiteDatabase(sqlite_database_path, "GEOPACKAGE")