diff --git a/HISTORY.rst b/HISTORY.rst index f63fb2d7..6fe110d1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,7 +5,7 @@ Change Log This document records all notable changes to `django-sql-explorer `_. This project adheres to `Semantic Versioning `_. -`4.1.0b1`_ (2024-04-17) +`4.1.0b2`_ (2024-04-17) =========================== * SQL Assistant: Built in query help via OpenAI (or LLM of choice), with relevant schema automatically injected into the prompt. Enable via setting EXPLORER_AI_API_KEY. diff --git a/explorer/__init__.py b/explorer/__init__.py index 2437dfe5..521ddd02 100644 --- a/explorer/__init__.py +++ b/explorer/__init__.py @@ -3,7 +3,7 @@ "minor": 1, "patch": 0, "releaselevel": "beta", - "serial": 1 + "serial": 2 } diff --git a/explorer/assistant/tests.py b/explorer/assistant/tests.py index 45828a13..a92dacf9 100644 --- a/explorer/assistant/tests.py +++ b/explorer/assistant/tests.py @@ -97,7 +97,6 @@ def test_sample_rows_from_tables(self): SimpleQueryFactory(title="First Query") SimpleQueryFactory(title="Second Query") ret = sample_rows_from_tables(CONN, ["explorer_query"]) - print(ret) self.assertTrue("First Query" in ret) self.assertTrue("Second Query" in ret) diff --git a/explorer/assistant/utils.py b/explorer/assistant/utils.py index 31f75f38..fb739d32 100644 --- a/explorer/assistant/utils.py +++ b/explorer/assistant/utils.py @@ -1,4 +1,3 @@ -import logging from explorer import app_settings from explorer.schema import schema_info from explorer.utils import get_valid_connection @@ -30,7 +29,6 @@ def do_req(prompt): messages=messages ) messages.append(resp.choices[0].message) - logging.info(f"Response: {messages}") return messages diff --git a/explorer/tracker.py b/explorer/tracker.py index 81d58c67..3cfc46fa 100644 --- a/explorer/tracker.py +++ b/explorer/tracker.py @@ -1,7 +1,7 @@ # Anonymous usage stats # Opt-out by setting EXPLORER_ENABLE_ANONYMOUS_STATS = False in settings - +import logging import time import requests import json @@ -14,6 +14,8 @@ from django.db.migrations.recorder import MigrationRecorder from django.conf import settings +logger = logging.getLogger(__name__) + def _instance_identifier(): """ @@ -77,9 +79,12 @@ def track(self): def _send(data): from explorer import app_settings - requests.post(app_settings.EXPLORER_COLLECT_ENDPOINT_URL, - data=data, - headers={"Content-Type": "application/json"}) + try: + requests.post(app_settings.EXPLORER_COLLECT_ENDPOINT_URL, + data=data, + headers={"Content-Type": "application/json"}) + except Exception as e: + logger.exception("Failed to send stats: %s" % e) def gather_summary_stats():