fix(automap): fixes naming conflicts for PostgreSQLProvider (#1184)

* fix(automap): fix naming conflicts for PostgreSQLProvider

Automaping classes and relationships from database schema throws an error if a
column name is the same as a relationship name (see
https://docs-sqlalchemy.readthedocs.io/ko/latest/orm/extensions/automap.html#handling-simple-naming-conflicts).

* renaming function name_for_scalar_relationship -> _name_for_scalar_relationship

* test: test that PostgreSQL provider can handle naming conflicts

Re-use data file from https://github.com/geopython/pygeoapi/pull/1185, and make
to new and empty tables that create naming conflicts when queried.

* Change test function post_collection_items -> get_collection_items

* fix path to table
This commit is contained in:
Mathieu Tachon
2023-03-31 13:05:31 +02:00
committed by GitHub
parent e8acad7120
commit 1a1d6362c1
5 changed files with 130 additions and 8 deletions
+7 -6
View File
@@ -1,17 +1,17 @@
name: Build
on:
on:
push:
paths-ignore:
- '**.md'
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '!**.md'
paths-ignore:
- '!**.md'
release:
types:
- released
- released
jobs:
flake8_py3:
@@ -78,7 +78,7 @@ jobs:
- name: Install sqlite and gpkg dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libsqlite3-mod-spatialite
packages: libsqlite3-mod-spatialite
version: 4.3.0a-6build1
- name: Install requirements 📦
run: |
@@ -96,6 +96,7 @@ jobs:
python3 tests/load_es_data.py tests/cite/ogcapi-features/canada-hydat-daily-mean-02HC003.geojson IDENTIFIER
python3 tests/load_mongo_data.py tests/data/ne_110m_populated_places_simple.geojson
gunzip < tests/data/hotosm_bdi_waterways.sql.gz | psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/dummy_data.sql
- name: run unit tests ⚙️
env:
POSTGRESQL_PASSWORD: ${{ secrets.DatabasePassword || 'postgres' }}