Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pyignite/api/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Only key-value queries (scan queries) are implemented. SQL part is still
in progress.
"""

from typing import Union

from pyignite.constants import *
Expand All @@ -28,7 +23,7 @@
from pyignite.datatypes.sql import StatementType
from pyignite.queries import Query
from pyignite.queries.op_codes import *
from pyignite.utils import cache_id
from pyignite.utils import cache_id, deprecated
from .result import APIResult


Expand Down Expand Up @@ -142,6 +137,8 @@ def scan_cursor_get_page(
return result


@deprecated(version='1.2.0', reason="This API is deprecated and will be removed in the following major release. "
"Use sql_fields instead")
def sql(
conn: 'Connection', cache: Union[str, int],
table_name: str, query_str: str, page_size: int, query_args=None,
Expand Down Expand Up @@ -227,6 +224,8 @@ def sql(
return result


@deprecated(version='1.2.0', reason="This API is deprecated and will be removed in the following major release. "
"Use sql_fields instead")
def sql_cursor_get_page(
conn: 'Connection', cursor: int, query_id: int = None,
) -> APIResult:
Expand Down
11 changes: 11 additions & 0 deletions pyignite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import ctypes
import decimal
import warnings

from functools import wraps
from threading import Event, Thread
Expand Down Expand Up @@ -313,3 +314,13 @@ def process_delimiter(name: str, delimiter: str) -> str:
Splits the name by delimiter, capitalize each part, merge.
"""
return ''.join([capitalize(x) for x in name.split(delimiter)])


def deprecated(version, reason):
def decorator_deprecated(fn):
@wraps(fn)
def wrapper_deprecated(*args, **kwds):
warnings.warn(f'Deprecated since {version}. The reason: {reason}', category=DeprecationWarning)
return fn(*args, **kwds)
return wrapper_deprecated
return decorator_deprecated