-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve MariaDB support * Fix pre-commit config * Fix CI and minor improvements --------- Co-authored-by: Tom Cook <tom.cook@veea.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4a5887a
commit f93cf5a
Showing
26 changed files
with
362 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""This module defines specific functions for MySQL dialect.""" | ||
|
||
from geoalchemy2.elements import WKBElement | ||
from geoalchemy2.elements import WKTElement | ||
from geoalchemy2.elements import _SpatialElement | ||
from geoalchemy2.exc import ArgumentError | ||
from geoalchemy2.shape import to_shape | ||
|
||
|
||
def bind_processor_process(spatial_type, bindvalue): | ||
if isinstance(bindvalue, str): | ||
wkt_match = WKTElement._REMOVE_SRID.match(bindvalue) | ||
srid = wkt_match.group(2) | ||
try: | ||
if srid is not None: | ||
srid = int(srid) | ||
except (ValueError, TypeError): # pragma: no cover | ||
raise ArgumentError( | ||
f"The SRID ({srid}) of the supplied value can not be casted to integer" | ||
) | ||
|
||
if srid is not None and srid != spatial_type.srid: | ||
raise ArgumentError( | ||
f"The SRID ({srid}) of the supplied value is different " | ||
f"from the one of the column ({spatial_type.srid})" | ||
) | ||
return wkt_match.group(3) | ||
|
||
if ( | ||
isinstance(bindvalue, _SpatialElement) | ||
and bindvalue.srid != -1 | ||
and bindvalue.srid != spatial_type.srid | ||
): | ||
raise ArgumentError( | ||
f"The SRID ({bindvalue.srid}) of the supplied value is different " | ||
f"from the one of the column ({spatial_type.srid})" | ||
) | ||
|
||
if isinstance(bindvalue, WKTElement): | ||
bindvalue = bindvalue.as_wkt() | ||
if bindvalue.srid <= 0: | ||
bindvalue.srid = spatial_type.srid | ||
return bindvalue | ||
elif isinstance(bindvalue, WKBElement): | ||
# With MariaDB we use Shapely to convert the WKBElement to an EWKT string | ||
return to_shape(bindvalue).wkt | ||
return bindvalue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ pytest | |
pytest-cov | ||
pytest-html | ||
pytest-mypy | ||
rasterio | ||
rasterio;implementation_name!='pypy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM ubuntu:22.04 | ||
|
||
COPY ./helpers/install_requirements.sh / | ||
RUN /install_requirements.sh | ||
|
||
RUN apt-get update; apt-get install -y mariadb-server mariadb-client; rm -rf /var/lib/apt/lists/*; | ||
|
||
COPY ./helpers/init_postgres.sh / | ||
ENV PGDATA="/var/lib/postgresql/data" | ||
ENV POSTGRES_PATH="/usr/lib/postgresql/16" | ||
RUN su postgres -c /init_postgres.sh | ||
|
||
ENV SPATIALITE_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/mod_spatialite.so" | ||
|
||
COPY ./helpers/init_mariadb.sh / | ||
RUN /init_mariadb.sh | ||
|
||
COPY ./helpers/entrypoint.sh / | ||
ENTRYPOINT ["/entrypoint.sh"] |
Oops, something went wrong.