Skip to content

Commit

Permalink
SNOW-1058245-sqlalchemy-20-support: code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mraba committed Apr 16, 2024
1 parent 6916ad4 commit 8d9ae09
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
29 changes: 0 additions & 29 deletions src/snowflake/sqlalchemy/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

import functools
import warnings
from typing import Callable

from sqlalchemy import __version__ as SA_VERSION
Expand All @@ -30,36 +29,8 @@ def wrapper(*args):
reduced_args = tuple(
arg for idx, arg in enumerate(args) if idx not in positions_to_drop
)
warnings.warn(
"This needs refactoring", DeprecationWarning, stacklevel=2
)
fn(*reduced_args)

return wrapper

return fn_wrapper


def args_filler(positions_to_insert: tuple):
"""This method inserts into args values at positions.
positions_to_insert is a tuple of tuple containing pair of posiotion and a value.
((6, False), (7, 42))
It will insert at position 6 value False, and at positoin 6 value 42.
"""

def fn_wrapper(fn: Callable):
@functools.wraps(fn)
def wrapper(*args):
extended_args = list(args)
if IS_VERSION_20:
for idx, value in positions_to_insert:
extended_args.insert(idx, value)
warnings.warn(
"This needs refactoring", DeprecationWarning, stacklevel=2
)
fn(*extended_args)

return wrapper

return fn_wrapper
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def get_engine(url: URL, **engine_kwargs):
return engine


# @pytest.fixture(scope="session")
@pytest.fixture()
def engine_testaccount(request):
url = url_factory()
Expand All @@ -165,7 +164,6 @@ def engine_testaccount(request):
yield engine


# @pytest.fixture(scope="session")
@pytest.fixture()
def engine_testaccount_with_numpy(request):
url = url_factory(numpy=True)
Expand All @@ -174,7 +172,6 @@ def engine_testaccount_with_numpy(request):
yield engine


# @pytest.fixture(scope="session")
@pytest.fixture()
def engine_testaccount_with_qmark(request):
snowflake.connector.paramstyle = "qmark"
Expand Down

0 comments on commit 8d9ae09

Please sign in to comment.