Commit Graph

9 Commits

Author SHA1 Message Date
Benjamin Webb 3d81115b1c Allow setting docker repository via repository secret (#1734) 2024-07-16 13:27:06 -04:00
Ricardo Garcia Silva e11cac67ac Upgrade ci to use ubuntu 22 04 (#1427)
* Refactored get_collection_coverage tests

Using pytest's parametrize mark. This makes it easier to isolate test cases in order to fix the errors that are showing up when running under Python3.8

* Add Python 3.8 to the CI matrix

* Reverted tests back to non-parametrized form

* Dropped Python 3.7 from main github CI workflow

* replaced ubuntu 20.04 with ubuntu 22.04 in CI workflow files

---------

Co-authored-by: Ricardo Garcia Silva <ricardo@kartoza.com>
2023-12-16 07:19:29 -05:00
Just van den Broecke c436baf739 #1110 try fix hanging Docker build GH Workflow - downgrade GH build env 2023-01-20 14:30:24 +01:00
Just van den Broecke 0e22b4fea5 #1110 - disable build for test and upgrade action versions (#1112) 2023-01-19 09:42:47 -05:00
Nick Forbes-Smith be5da13016 Fix workflow_dispatch event for Publish Docker image workflow (#1077) 2022-12-23 11:14:48 -05:00
John A Stevenson 644281359a Add CQL to PostgreSQL provider (via pygeofilter and sqlalchemy) (#964)
* Add pygeofilter, unpin psycopg2

* Add pygeofilter SQLAlchemy query demo

* Add note about primary key

* Add todos to script

* Make script generic

* Add (commented out) PostgreSQL provider hotosm_bdi_waterways to config

* Update to use local test database

* Return result as dictionary

* Pass GEOM_FIELD as variable

* Add offset and limt, fix two names

* Implement order by

* Use function for cql query

* Add cql query block to query and test

* Link up to db engine

* Convert WKB geometry to GeoJSON

* Add shapely as explicit dependency

* Add tests for CQL queries

* Add test using CROSSES with LINESTRING

* Uncomment Docker PostGIS test layer

* First pass at wiring up API

The CQL is read from the request but the parser fails to convert to
AST.

* Turn logging to DEBUG

Example query
http://localhost:5000/collections/hot_osm_waterways/items?cql=%27osm_id%20BETWEEN%2080800000%20AND%2080900000%20AND%20name%20IS%20NULL%27

* Create dedicated pygeoapi-config.yml for testing PostgreSQL

* Add test for PostgreSQL CQL

* Return 400 for bad CQL

* Tidy up old files

* Bring API error type tests together

* Only reflect the table of interest

* Add pygeofilter to requirements

* Remove local setup_env.sh from .gitignore

* Remove lark exception handling

* Remove lark codes from tests, docstring change

* Split cql test into good and error

* Rename cql parameter to filter

* Add optional filter-lang parameter with test

* Initial changes

* Rename cql text parser

* Use CQL-JSON POST for PostgreSQL query

* Refactor to get data early and handle errors

* Add error tests for CQL-JSON PostgreSQL

* Add tests for prev/next and provider instantiation

* As filter-lang is set the block in not needed

* Clarify test fixtures

* Use filterq only in all CQL calls

* Make engine and table_model attributes of provider

* Handle different instantiation failures

* Use SQLAlchemy for get_fields()

* Minor doc edits

* Use SQLAlchemy for get()

* Simplify _sqlalchemy_to_feature

* Store database parameters in dedicated function

* Strip out non-SQLAlchemy code

* Add draft query() based on CQL filters

* Add property filtering to query()

* Implement select_properties and skip_geometry

* Implement bbox filter

* Implement properties subset defined in config

* Clean up materialized view test

We only need to test the fields that are present to be sure that the
view has been accessed, so other checks have been removed.

* Flake8 fixes and tidy up

* Add combined test for CQL with bbox and properties

* Create sessions directly where required

* Add Engine store to allow connection reuse

* Replace cql_ast with filterq

* Tidy up tests by using fixture for api

* Add authors

* Use Session() as context manager

A session requires a connection to the database, as provided by the
SQLAlchemy engine.  When the session goes out of scope, e.g. at exit
from the function when it was used, it should be garbage collected and
the connection freed.  However, during load testing it was found that
this wasn't happening.  This commit uses a context manager pattern to
start the session, which ensures that the session is closed at the end
of the `with` block.

* Return fields type as {'type': ...}

* Cache the table_model with the engine

Generating the table_model by "reflecting" the database is expensive but
the resulting model doesn't change.  If we cache the table_model with
the engine we save on a round-trip to the database and speed up response
time.

* Use separate stores for Engine and table_models

Using a combined store based on both engine and table_model meant that
a pygeoapi serving multiple tables on the same database would maintain
a connection pool for each table.  This could eventually saturate the
number of available connections.  This commit separates the store into
two parts.

* Update documentation with example

* Manage or post items based on POST content type

* ghcr build action

* only ghcr job

* run criteria edit

* Update README.md

* job = main

* remove success requirememt

* add tag

* tags: bgs-cql

* Update main.yml

* Update README.md

* remove binary

* update

* Update actions to latest versions

* Dockerfile refactor

* Dockerfile refactor

* restore dockerhub

* fix pygeoif version

* # 3.6 test & dockerhub ref

* Pin pygeoif version to less than 1

* Replace psycopg-binary with psycopg

* Split Docker build into sections

* Pin click version >7,<=8

* Add further cql examples

* Update workflows to match GeoPython repo

* update flake python version

* Unquote PostgreSQL column names

* Update container workflow uses versions

* flake8 use python version 3.7

* Use pre ping to get db connection

* Test that properties are set in provider

* Amendments as requested by @tomkralidis

* Correction

* Fix reviewed changes in api code

Co-authored-by: Colin Blackburn <colb@bgs.ac.uk>
Co-authored-by: KoalaGeo <eddlewis85@gmail.com>
Co-authored-by: Edd <edlew@bgs.ac.uk>
Co-authored-by: Colin Blackburn <ximenesuk@users.noreply.github.com>
2022-10-29 02:15:31 -04:00
KoalaGeo ad3e224f62 Actions pr (#1021)
* Removed branches requirement on build action

Build action will now run whenever Lint job is completed: All pushes, PR to Master branch & releases

* Put lint in same main.yml

Lint is still a requirement for the build job

* Docker build only runs on master branch
2022-10-17 16:19:32 -04:00
Just van den Broecke 2b149ad184 fix for issue 989 - get Docker build/push working (#997)
* fix for issue 989 - get Docker build/push working - try 1

* fix for issue 989 - get Docker build/push working - try 2 - remove tests - new WFS GeoSolutions
2022-09-27 21:19:38 +02:00
KoalaGeo 8cd1e737f2 PR #801 for #989: GH Workflow - Docker Build+Push to DockerHub and GH Container Registry
* Create ghcr.yml

Create and publish a Docker image to GitHub Container Registry

* Update installation.rst

Add reference to GitHub Container registry

* Update running-with-docker.rst

Add ghcr references

* Make ghcr conditional on main.yml

Updated main.yml run conditions & add on-success condition to ghcr.yml

* Miss aligned

* change workflow name

GHCR

* Update build to Build

Names didn't match GHCR condition

* Remove cog symbol from Build name

* Add paths-ignore

**.md

* Added build & push to DockerHub

* Add authorship & update header

* Tidy yml, add on-success condition

* Add on failure condition

* Remove GHC Tests and Conditional Push

* DockerHub Test - koalageo/pygeoapi

* DockerHub - Revert to geopython/pygeoapi

* Use SECRET for DockerHub repo

* Combined Build & Push

* Update tag function

* Fix tags for latest

* Lastest tag only on `master`

* Use tag on push tag event

* Add latest tag on default branch

* Add unit tests step

* Add separate build & test steps

* Typo in docs

* Move flake8 to before tests - catch errors early

* Add further tags

Co-authored-by: Benjamin Webb <40066515+webb-ben@users.noreply.github.com>

Co-authored-by: Benjamin Webb <40066515+webb-ben@users.noreply.github.com>
2022-09-26 23:38:34 +02:00