Skip to content

MySQL OAF provider #2004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ jobs:
with:
postgresql password: ${{ secrets.DatabasePassword || 'postgres' }}
postgresql db: 'test'

- name: "Install and run MySQL 📦"
uses: mirromutth/[email protected]
with:
host port: 3306
mysql version: '8.0'
mysql database: test_geo_app
mysql root password: mysql # This is a dummy password here; not actually used in prod
mysql user: pygeoapi
mysql password: mysql

- name: Install and run Elasticsearch 📦
uses: getong/[email protected]
with:
Expand Down Expand Up @@ -111,6 +122,7 @@ jobs:
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/dummy_data.sql
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/dummy_types_data.sql
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/postgres_manager_full_structure.backup.sql
mysql -h 127.0.0.1 -P 3306 -u root -p'mysql' test_geo_app < tests/data/mysql_data.sql
docker ps
python3 tests/load_oracle_data.py
- name: run unit tests ⚙️
Expand Down Expand Up @@ -142,6 +154,7 @@ jobs:
pytest tests/test_oracle_provider.py
pytest tests/test_parquet_provider.py
pytest tests/test_postgresql_provider.py
pytest tests/test_mysql_provider.py
pytest tests/test_rasterio_provider.py
pytest tests/test_sensorthings_edr_provider.py
pytest tests/test_sensorthings_provider.py
Expand Down
3 changes: 2 additions & 1 deletion pygeoapi/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@
'MVT-tippecanoe': 'pygeoapi.provider.mvt_tippecanoe.MVTTippecanoeProvider', # noqa: E501
'MVT-elastic': 'pygeoapi.provider.mvt_elastic.MVTElasticProvider',
'MVT-proxy': 'pygeoapi.provider.mvt_proxy.MVTProxyProvider',
'MySQL': 'pygeoapi.provider.sql.MySQLProvider',
'OracleDB': 'pygeoapi.provider.oracle.OracleProvider',
'OGR': 'pygeoapi.provider.ogr.OGRProvider',
'OpenSearch': 'pygeoapi.provider.opensearch_.OpenSearchProvider',
'Parquet': 'pygeoapi.provider.parquet.ParquetProvider',
'PostgreSQL': 'pygeoapi.provider.postgresql.PostgreSQLProvider',
'PostgreSQL': 'pygeoapi.provider.sql.PostgreSQLProvider',
'rasterio': 'pygeoapi.provider.rasterio_.RasterioProvider',
'SensorThings': 'pygeoapi.provider.sensorthings.SensorThingsProvider',
'SensorThingsEDR': 'pygeoapi.provider.sensorthings_edr.SensorThingsEDRProvider', # noqa: E501
Expand Down
6 changes: 4 additions & 2 deletions pygeoapi/process/manager/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
ProcessorGenericError
)
from pygeoapi.process.manager.base import BaseManager
from pygeoapi.provider.postgresql import get_engine, get_table_model
from pygeoapi.provider.sql import get_engine, get_table_model
from pygeoapi.util import JobStatus


Expand Down Expand Up @@ -92,13 +92,15 @@ def __init__(self, manager_def: dict):
if isinstance(self.connection, str):
_url = make_url(self.connection)
self._engine = get_engine(
'postgresql+psycopg2',
_url.host,
_url.port,
_url.database,
_url.username,
_url.password)
else:
self._engine = get_engine(**self.connection)
self._engine = get_engine('postgresql+psycopg2',
**self.connection)
except Exception as err:
msg = 'Test connecting to DB failed'
LOGGER.error(f'{msg}: {err}')
Expand Down
Loading