Skip to content

Commit

Permalink
Use private endpoint by default for GeoServer Reloads (#24)
Browse files Browse the repository at this point in the history
* Use private endpoint by default for gs reloads

* Increment patch version

* Revert "Use private endpoint by default for gs reloads"

This reverts commit 51c17ce.

* 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
  • Loading branch information
swainn committed Mar 30, 2023
1 parent dd2c711 commit 157d2c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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 = [email protected]
Expand Down Expand Up @@ -43,7 +43,7 @@ install_requires =
geoserver-restconfig
requests
requests_toolbelt
sqlalchemy
sqlalchemy<2
psycopg2-binary

[options.packages.find]
Expand Down
6 changes: 4 additions & 2 deletions tethys_dataset_services/engines/geoserver_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 157d2c9

Please sign in to comment.