Skip to content

Commit

Permalink
Pandas is optional (#632)
Browse files Browse the repository at this point in the history
* pandas is optional
* 5.0.1 release
  • Loading branch information
chrisclark authored Jun 26, 2024
1 parent 77250dc commit 970d87b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
9 changes: 8 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Change Log
This document records all notable changes to `django-sql-explorer <https://github.com/explorerhq/django-sql-explorer>`_.
This project adheres to `Semantic Versioning <https://semver.org/>`_.

`5.0.1`_ (2024-06-26)
===========================
* `#631`_: Pandas is only required if EXPLORER_USER_UPLOADS_ENABLED is True

`5.0.0`_ (2024-06-25)
===========================

Expand Down Expand Up @@ -471,7 +475,9 @@ Initial Release
.. _4.1.0: https://github.com/explorerhq/django-sql-explorer/compare/4.0.2...4.1.0
.. _4.2.0: https://github.com/explorerhq/django-sql-explorer/compare/4.1.0...4.2.0
.. _4.3.0: https://github.com/explorerhq/django-sql-explorer/compare/4.2.0...4.3.0
.. _5.0.0: https://github.com/explorerhq/django-sql-explorer/compare/4.2.0...5.0.0
.. _5.0.0: https://github.com/explorerhq/django-sql-explorer/compare/4.3.0...5.0.0
.. _5.0.1: https://github.com/explorerhq/django-sql-explorer/compare/5.0.0...5.0.1


.. _#254: https://github.com/explorerhq/django-sql-explorer/pull/254
.. _#334: https://github.com/explorerhq/django-sql-explorer/pull/334
Expand Down Expand Up @@ -573,5 +579,6 @@ Initial Release
.. _#616: https://github.com/explorerhq/django-sql-explorer/issues/616
.. _#618: https://github.com/explorerhq/django-sql-explorer/issues/618
.. _#619: https://github.com/explorerhq/django-sql-explorer/issues/619
.. _#631: https://github.com/explorerhq/django-sql-explorer/issues/631

.. _furo: https://github.com/pradyunsg/furo
2 changes: 1 addition & 1 deletion explorer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__version_info__ = {
"major": 5,
"minor": 0,
"patch": 0,
"patch": 1,
"releaselevel": "final",
"serial": 0
}
Expand Down
2 changes: 1 addition & 1 deletion explorer/ee/db_connections/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from dateutil import parser

import pandas as pd
import sqlite3
import io

Expand Down Expand Up @@ -126,6 +125,7 @@ def atof_custom(value):
return float(value)

def csv_to_typed_df(csv_bytes, delimiter=",", has_headers=True): # noqa
import pandas as pd
try:

csv_file = io.BytesIO(csv_bytes)
Expand Down
8 changes: 7 additions & 1 deletion explorer/tests/test_db_connection_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from django.test import TestCase
from unittest import skipIf
from django.core.files.uploadedfile import SimpleUploadedFile
import pandas as pd
from explorer.app_settings import EXPLORER_USER_UPLOADS_ENABLED
if EXPLORER_USER_UPLOADS_ENABLED:
import pandas as pd
import os
import sqlite3
from explorer.models import DatabaseConnection
Expand All @@ -25,6 +28,7 @@ def _get_csv(csv_name):
return csv_bytes


@skipIf(not EXPLORER_USER_UPLOADS_ENABLED, "User uploads not enabled")
class TestCsvToTypedDf(TestCase):

def test_mixed_types(self):
Expand Down Expand Up @@ -61,6 +65,7 @@ def test_date_parsing(self):
self.assertTrue(pd.api.types.is_datetime64_ns_dtype(df["Dates"]))


@skipIf(not EXPLORER_USER_UPLOADS_ENABLED, "User uploads not enabled")
class TestSQLiteConnection(TestCase):

@patch("explorer.utils.get_s3_bucket")
Expand Down Expand Up @@ -139,6 +144,7 @@ def test_create_django_style_connection_non_sqlite(self, mock_load_backend):
mock_backend.DatabaseWrapper.assert_called_once()


@skipIf(not EXPLORER_USER_UPLOADS_ENABLED, "User uploads not enabled")
class TestPandasToSQLite(TestCase):

def test_pandas_to_sqlite(self):
Expand Down

0 comments on commit 970d87b

Please sign in to comment.