Skip to content

SNOW-2199122 Replace is_datetime64tz_dtype with isinstance to resolve pandas deprecation warning #2431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ dependencies installed with `snowflake-connector-python` installed as an editabl
Setting up a development environment is super easy with this [one simple tox command](https://tox.wiki/en/latest/example/devenv.html).

```shell
tox --devenv venv37 -e py37
. venv37/bin/activate
tox --devenv venv39 -e py39
. venv39/bin/activate
```

Note: we suggest using the lowest supported Python version for development.
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/connector/pandas_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def write_pandas(
# use_logical_type should be True when dataframe contains datetimes with timezone.
# https://github.com/snowflakedb/snowflake-connector-python/issues/1687
if not use_logical_type and any(
[pandas.api.types.is_datetime64tz_dtype(df[c]) for c in df.columns]
[isinstance(df[c], pandas.DatetimeTZDtype) for c in df.columns]
):
warnings.warn(
"Dataframe contains a datetime with timezone column, but "
Expand Down
8 changes: 4 additions & 4 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ We use `tox` version 4 to run test suites and other utilities.
To run the most important tests, execute:

```shell
tox -e "fix_lint,py37{,-pandas,-sso}"
tox -e "fix_lint,py39{,-pandas,-sso}"
```

**NOTE** Some integration tests may be sensitive to the cloud provider of the
Expand All @@ -37,10 +37,10 @@ is made.

### Running a single test

Enter the tox environment you want (e.g. `py38`) and run `pytest` from there:
Enter the tox environment you want (e.g. `py39`) and run `pytest` from there:

```shell
. .tox/py38/bin/activate
. .tox/py39/bin/activate
pytest -v test/integ/test_connection.py::test_basic
```

Expand All @@ -55,7 +55,7 @@ either does the same as providing both of them.
## Test categories
Chaining these categories is possible, but isn't encouraged.
Note: running multiple categories in one `tox` run should be done like:
`tox -e "fix_lint,py37-{,-sso},coverage"`
`tox -e "fix_lint,py39-{,-sso},coverage"`

* **pandas**: Tests specifically testing our optional dependency group "pandas".
* **sso**: Tests specifically testing our optional dependency group "sso".
Expand Down
2 changes: 1 addition & 1 deletion test/extras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
These are tests that test weird edge cases when we need a standalone Python environment
and process.

Run only these tests with `tox`, for example: `tox -e py38-extras` from the
Run only these tests with `tox`, for example: `tox -e py39-extras` from the
top directory.