diff --git a/google/cloud/spanner_dbapi/connection.py b/google/cloud/spanner_dbapi/connection.py index 3dec2bd028..2e60faecc0 100644 --- a/google/cloud/spanner_dbapi/connection.py +++ b/google/cloud/spanner_dbapi/connection.py @@ -31,7 +31,6 @@ from google.cloud.spanner_dbapi.cursor import Cursor from google.cloud.spanner_v1 import RequestOptions from google.cloud.spanner_v1.snapshot import Snapshot -from deprecated import deprecated from google.cloud.spanner_dbapi.exceptions import ( InterfaceError, @@ -187,10 +186,11 @@ def autocommit_dml_mode(self): return self._autocommit_dml_mode @property - @deprecated( - reason="This method is deprecated. Use _spanner_transaction_started field" - ) def inside_transaction(self): + warnings.warn( + "This method is deprecated. Use _spanner_transaction_started field", + DeprecationWarning, + ) return ( self._transaction and not self._transaction.committed diff --git a/google/cloud/spanner_dbapi/parse_utils.py b/google/cloud/spanner_dbapi/parse_utils.py index 3f8f61af08..5446458819 100644 --- a/google/cloud/spanner_dbapi/parse_utils.py +++ b/google/cloud/spanner_dbapi/parse_utils.py @@ -17,12 +17,12 @@ import datetime import decimal import re +import warnings import sqlparse from google.cloud import spanner_v1 as spanner from google.cloud.spanner_v1 import JsonObject from . import client_side_statement_parser -from deprecated import deprecated from .exceptions import Error from .parsed_statement import ParsedStatement, StatementType, Statement @@ -179,7 +179,6 @@ RE_PYFORMAT = re.compile(r"(%s|%\([^\(\)]+\)s)+", re.DOTALL) -@deprecated(reason="This method is deprecated. Use _classify_stmt method") def classify_stmt(query): """Determine SQL query type. :type query: str @@ -187,6 +186,10 @@ def classify_stmt(query): :rtype: str :returns: The query type name. """ + warnings.warn( + "This method is deprecated. Use _classify_stmt method", DeprecationWarning + ) + # sqlparse will strip Cloud Spanner comments, # still, special commenting styles, like # PostgreSQL dollar quoted comments are not diff --git a/setup.py b/setup.py index 4518234679..ca44093157 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,6 @@ "sqlparse >= 0.4.4", "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - "deprecated >= 1.2.14", "grpc-interceptor >= 0.15.4", ] extras = {