Skip to content

Commit

Permalink
Merge branch 'develop' into feat/geom_4326
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize authored Dec 8, 2023
2 parents 33bf142 + 0e8b830 commit 9c92bac
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 38 deletions.
43 changes: 13 additions & 30 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
strategy:
fail-fast: false
matrix:
debian-version: ["11", "12"]
sqlalchemy-version: ["1.4"]
debian-version: [ '11', '12' ]
sqlalchemy-version: [ '1.4' ]
include:
- debian-version: "11"
python-version: "3.9"
postgres-version: "11"
postgis-version: "2.5"
- debian-version: "12"
python-version: "3.11"
postgres-version: "13"
postgis-version: "3.2"
- debian-version: '11'
python-version: '3.9'
postgres-version: '13'
postgis-version: '3.2'
- debian-version: '12'
python-version: '3.11'
postgres-version: '15'
postgis-version: '3.3'

name: Debian ${{ matrix.debian-version}} - SQLAlchemy ${{ matrix.sqlalchemy-version }}

Expand All @@ -50,14 +50,9 @@ jobs:
--health-retries 5
steps:
- name: Add postgis_raster database extension
if: ${{ matrix.postgis-version >= 3 }}
run: |
psql -h localhost -U geouser -d refgeo -tc 'CREATE EXTENSION "postgis_raster";'
env:
PGPASSWORD: geopasswd
- name: Add database extensions
run: |
psql -h localhost -U geouser -d refgeo -tc 'CREATE EXTENSION "postgis_raster";'
psql -h localhost -U geouser -d refgeo -tc 'CREATE EXTENSION "hstore";'
psql -h localhost -U geouser -d refgeo -tc 'CREATE EXTENSION "uuid-ossp";'
psql -h localhost -U geouser -d refgeo -tc 'CREATE EXTENSION "pg_trgm";'
Expand All @@ -77,24 +72,12 @@ jobs:
sudo apt update
sudo apt install -y libgdal-dev
- name: Install dependencies
if: ${{ matrix.sqlalchemy-version == '1.3' }}
run: |
python -m pip install --upgrade pip
python -m pip install \
-e .[tests] \
-e dependencies/Utils-Flask-SQLAlchemy \
-e dependencies/Utils-Flask-SQLAlchemy-Geo \
'sqlalchemy>=1.3,<1.4' \
'flask-sqlalchemy<3'
- name: Install dependencies
if: ${{ matrix.sqlalchemy-version == '1.4' }}
run: |
python -m pip install --upgrade pip
python -m pip install \
-e .[tests] \
-e dependencies/Utils-Flask-SQLAlchemy \
-e dependencies/Utils-Flask-SQLAlchemy-Geo \
'sqlalchemy>=1.4,<2'
-e dependencies/Utils-Flask-SQLAlchemy-Geo
- name: Show database branches and dependencies
run: |
flask db status --dependencies
Expand All @@ -110,7 +93,7 @@ jobs:
run: |
pytest -v --cov --cov-report xml
- name: Upload coverage to Codecov
if: ${{ matrix.debian-version == '11' && matrix.sqlalchemy-version == '1.4' }}
if: ${{ matrix.debian-version == '12' && matrix.sqlalchemy-version == '1.4' }}
uses: codecov/codecov-action@v3
with:
flags: pytest
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ flask>=2.1
flask-sqlalchemy
flask-marshmallow
python-dotenv
sqlalchemy<2
sqlalchemy>=1.4,<2
utils-flask-sqlalchemy>=0.3.0
utils-flask-sqlalchemy-geo>=0.2.8
psycopg2
7 changes: 1 addition & 6 deletions src/ref_geo/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
routes = Blueprint("ref_geo", __name__)


altitude_stmt = sa.select(
[
sa.column("altitude_min"),
sa.column("altitude_max"),
]
).select_from(
altitude_stmt = sa.select(sa.column("altitude_min"), sa.column("altitude_max")).select_from(
func.ref_geo.fct_get_altitude_intersection(
func.ST_SetSRID(
func.ST_GeomFromGeoJSON(sa.bindparam("geojson")),
Expand Down
3 changes: 2 additions & 1 deletion src/ref_geo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
methodes pour ref_geo
- recupération du srid local
"""
from sqlalchemy import text


def get_local_srid(bind):
"""
permet de récupérer le srid local ( celui de ref_geo.l_areras.geom)
"""
return bind.execute("SELECT FIND_SRID('ref_geo', 'l_areas', 'geom')").scalar()
return bind.execute(text("SELECT FIND_SRID('ref_geo', 'l_areas', 'geom')")).scalar()

0 comments on commit 9c92bac

Please sign in to comment.