gws.base.database.util¶
Database utilities.
Source code: gws.base.database.util
Module Contents¶
- gws.base.database.util.shape_intersects_clause(column, shape: gws.Shape, crs: gws.Crs) gws.lib.sa.ColumnElement¶
Create a where clause that matches geometries intersecting a shape.
- Parameters:
column – Geometry column expression.
shape – Shape to intersect with.
crs – CRS of the column. The shape is transformed to it.
- Returns:
An
ST_Intersectsclause.
- gws.base.database.util.text_search_clause(column, value: str | None, tso: gws.TextSearchOptions | None) gws.lib.sa.ColumnElement | None¶
Create a where clause that matches a column against a search string.
The value is stripped. For the
any,beginandendsearch types,LIKEwildcards in the value match literally. For theliketype, the value is used as aLIKEpattern, with\as the escape character.- Parameters:
column – Column expression to match.
value – Search string.
tso – Text search options. Without options, the value is matched exactly.
- Returns:
A clause, or
Noneif the value is empty or shorter than the minimum length.