stratified_packager.toolbelt.sql
Plugin-agnostic SQL string building for the SQLite/GeoPackage dialect.
Pure standard library: this module imports neither qgis nor osgeo (GDAL/OGR), so its
helpers stay usable from background threads, scripts/ and osgeo-free tests. It owns the SQL
text concerns — identifier quoting and reserved-table-name guarding — while
gpkg owns the OGR and sqlite3 work that consumes the quoting.
Functions
|
Quote an SQL identifier (table or column name) with double quotes. |
|
Prefix |
- stratified_packager.toolbelt.sql.quote_identifier(name, /)[source]
Quote an SQL identifier (table or column name) with double quotes.
- stratified_packager.toolbelt.sql.safe_table_name(name, /)[source]
Prefix
_to dodge GeoPackage/SQLite reserved table-name prefixes.OGR refuses to create a GeoPackage layer whose name begins with
gpkg, and SQLite reserves thesqlite_prefix for its own tables. A name that begins with either (case-insensitively, since both dialects fold table-name case) gets a leading_; every other name is returned unchanged. Idempotent:_gpkg…no longer matches.
- stratified_packager.toolbelt.sql._RESERVED_TABLE_PREFIXES: Final = ('gpkg', 'sqlite_')
Reserved table-name prefixes: OGR rejects
gpkg; SQLite reservessqlite_.