From 157d2c96b9856542eaa8242f9bb6982509787b71 Mon Sep 17 00:00:00 2001 From: Nathan Swain Date: Thu, 30 Mar 2023 10:48:34 -0600 Subject: [PATCH] Use private endpoint by default for GeoServer Reloads (#24) * Use private endpoint by default for gs reloads * Increment patch version * Revert "Use private endpoint by default for gs reloads" This reverts commit 51c17ce47b3d509b474a38249fc005ea33465225. * Create sql view layer use private endpoint reload * Pin sqlalchemy <2 * Turn on SQLAlchemy 2 warnings (for future reference) * Set sqlalchemy env var in tox instead --- setup.cfg | 4 ++-- tethys_dataset_services/engines/geoserver_engine.py | 6 ++++-- tox.ini | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 0c56365..c53d233 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = tethys_dataset_services -version = 2.2.0 +version = 2.2.1 description = A generic Python interface for dataset services such as GeoServer, CKAN, and HydroShare author = Nathan Swain author_email = nswain@aquaveo.com @@ -43,7 +43,7 @@ install_requires = geoserver-restconfig requests requests_toolbelt - sqlalchemy + sqlalchemy<2 psycopg2-binary [options.packages.find] diff --git a/tethys_dataset_services/engines/geoserver_engine.py b/tethys_dataset_services/engines/geoserver_engine.py index 2635ae5..b6b6515 100644 --- a/tethys_dataset_services/engines/geoserver_engine.py +++ b/tethys_dataset_services/engines/geoserver_engine.py @@ -1400,7 +1400,8 @@ def create_layer_from_postgis_store(self, store_id, table, debug=False): return response_dict def create_sql_view_layer(self, store_id, layer_name, geometry_type, srid, sql, default_style, - geometry_name='geometry', other_styles=None, parameters=None, debug=False): + geometry_name='geometry', other_styles=None, parameters=None, reload_public=False, + debug=False): """ Direct call to GeoServer REST API to create SQL View feature types and layers. @@ -1414,6 +1415,7 @@ def create_sql_view_layer(self, store_id, layer_name, geometry_type, srid, sql, default_style: The name of the default style. Can be a name or a workspace-name combination (e.g.: "name" or "workspace:name"). other_styles: A list of other default style names. Can be a name or a workspace-name combination (e.g.: "name" or "workspace:name"). parameters: A list of parameter dictionaries { name, default_value, regex_validator }. + reload_public: (bool, optional): Reload the catalog using the public endpoint. Defaults to False. debug (bool, optional): Pretty print the response dictionary to the console for debugging. Defaults to False. """ # noqa: E501 # Process identifier @@ -1476,7 +1478,7 @@ def create_sql_view_layer(self, store_id, layer_name, geometry_type, srid, sql, raise exception # Reload before attempting to update styles to avoid issues - self.reload() + self.reload(public=reload_public) # Add styles to new layer self.update_layer_styles( diff --git a/tox.ini b/tox.ini index 23121aa..8e4d288 100644 --- a/tox.ini +++ b/tox.ini @@ -32,6 +32,8 @@ commands = coverage erase [testenv:e2e_gs_tests] +setenv = + SQLALCHEMY_WARN_20 = 1 commands = pytest tests/e2e_tests/geoserver_engine_e2e_tests.py