Skip to content

Commit

Permalink
Fix deprecation warnings (#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpacemanPaul committed Jul 24, 2023
1 parent c97bf11 commit 75c57b1
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conda-environment.yml
Expand Up @@ -22,7 +22,7 @@ dependencies:
- dask
- pyproj >=2.5
- shapely >=2.0
- jsonschema
- jsonschema <4.18
- lark
- netcdf4
- numpy
Expand Down
5 changes: 4 additions & 1 deletion datacube/drivers/postgis/_core.py
Expand Up @@ -11,6 +11,7 @@
from sqlalchemy import MetaData, inspect, text
from sqlalchemy.engine import Engine
from sqlalchemy.schema import CreateSchema
from sqlalchemy.sql.ddl import DropSchema

from datacube.drivers.postgis.sql import (INSTALL_TRIGGER_SQL_TEMPLATE,
SCHEMA_NAME, TYPES_INIT_SQL,
Expand Down Expand Up @@ -220,7 +221,9 @@ def has_schema(engine):


def drop_db(connection):
connection.execute(text(f'drop schema if exists {SCHEMA_NAME} cascade'))
# if_exists parameter seems to not be working in SQLA1.4?
if has_schema(connection.engine):
connection.execute(DropSchema(SCHEMA_NAME, cascade=True, if_exists=True))


def to_pg_role(role):
Expand Down
6 changes: 4 additions & 2 deletions datacube/drivers/postgres/_core.py
Expand Up @@ -17,7 +17,7 @@
pg_column_exists)
from sqlalchemy import MetaData, inspect, text
from sqlalchemy.engine import Engine
from sqlalchemy.schema import CreateSchema
from sqlalchemy.schema import CreateSchema, DropSchema


USER_ROLES = ('agdc_user', 'agdc_ingest', 'agdc_manage', 'agdc_admin')
Expand Down Expand Up @@ -233,7 +233,9 @@ def has_schema(engine):


def drop_db(connection):
connection.execute(text(f'drop schema if exists {SCHEMA_NAME} cascade;'))
# if_exists parameter seems to not be working in SQLA1.4?
if has_schema(connection.engine):
connection.execute(DropSchema(SCHEMA_NAME, cascade=True, if_exists=True))


def to_pg_role(role):
Expand Down
2 changes: 1 addition & 1 deletion docker/constraints.in
Expand Up @@ -14,7 +14,7 @@ dask>=2021.10.1
distributed>=2021.10.0
fiona
geoalchemy2
jsonschema
jsonschema<4.18
# Was lark-parser>=0.6.7
lark
matplotlib
Expand Down
1 change: 1 addition & 0 deletions docs/about/whats_new.rst
Expand Up @@ -27,6 +27,7 @@ v1.8.next
- Improve error message for mismatch between dataset metadata and product signature (:pull:`1472`)
- Mark ``--confirm-ignore-lineage``, ``--auto-add-lineage``, and ``--verify-lineage`` as deprecated or to be deprecated (:pull:`1472`)
- Default delta values in ``archive_less_mature`` and ``find_less_mature`` (:pull:`1472`)
- Fix SQLAlchemy calls and pin jsonschema version to suppress deprecation warnings (:pull:`1476`)

v1.8.15 (11th July 2023)
========================
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -98,7 +98,7 @@
'cloudpickle>=0.4',
'dask[array]',
'distributed',
'jsonschema',
'jsonschema<4.18',
'numpy',
'psycopg2',
'lark',
Expand All @@ -114,6 +114,7 @@
'packaging',
'odc-geo',
'deprecat',
'importlib_metadata>3.5;python_version<"3.10"',
],
extras_require=extras_require,
tests_require=tests_require,
Expand Down
1 change: 1 addition & 0 deletions wordlist.txt
Expand Up @@ -223,6 +223,7 @@ jfEZEOkxRXgNsAsHEC
jpg
JSON
jsonify
jsonschema
Jupyter
jupyter
JupyterLab
Expand Down

0 comments on commit 75c57b1

Please sign in to comment.