Skip to content

Commit

Permalink
4.1b2
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisclark committed Apr 17, 2024
1 parent e278a71 commit e27f6eb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Change Log
This document records all notable changes to `django-sql-explorer <https://github.com/chrisclark/django-sql-explorer>`_.
This project adheres to `Semantic Versioning <https://semver.org/>`_.

`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.
Expand Down
2 changes: 1 addition & 1 deletion explorer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"minor": 1,
"patch": 0,
"releaselevel": "beta",
"serial": 1
"serial": 2
}


Expand Down
1 change: 0 additions & 1 deletion explorer/assistant/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 0 additions & 2 deletions explorer/assistant/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
from explorer import app_settings
from explorer.schema import schema_info
from explorer.utils import get_valid_connection
Expand Down Expand Up @@ -30,7 +29,6 @@ def do_req(prompt):
messages=messages
)
messages.append(resp.choices[0].message)
logging.info(f"Response: {messages}")
return messages


Expand Down
13 changes: 9 additions & 4 deletions explorer/tracker.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,6 +14,8 @@
from django.db.migrations.recorder import MigrationRecorder
from django.conf import settings

logger = logging.getLogger(__name__)


def _instance_identifier():
"""
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit e27f6eb

Please sign in to comment.