Skip to content

Commit

Permalink
Add connection debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
kesmit13 committed Oct 11, 2023
1 parent e0bf8af commit 346f3f8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = singlestoredb
version = 0.7.1
version = 0.7.2
description = Interface to the SingleStore database and cluster management APIs
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
2 changes: 1 addition & 1 deletion singlestoredb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""

__version__ = '0.7.1'
__version__ = '0.7.2'

from .config import options, get_option, set_option, describe_option
from .connection import connect, apilevel, threadsafety, paramstyle
Expand Down
7 changes: 7 additions & 0 deletions singlestoredb/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,10 @@
'Print queries and parameters to stderr.',
environ='SINGLESTOREDB_DEBUG_QUERIES',
)


register_option(
'debug.connection', 'bool', check_bool, False,
'Print connection tracing information.',
environ='SINGLESTOREDB_DEBUG_CONNECTION',
)
4 changes: 3 additions & 1 deletion singlestoredb/mysql/_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
from functools import partial
import hashlib

from ..config import get_option

DEBUG = False

DEBUG = get_option('debug.connection')
SCRAMBLE_LENGTH = 20
sha1_new = partial(hashlib.new, 'sha1')

Expand Down
3 changes: 2 additions & 1 deletion singlestoredb/mysql/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
LoadLocalPacketWrapper,
)
from . import err
from ..config import get_option
from ..connection import Connection as BaseConnection

try:
Expand All @@ -65,7 +66,7 @@
# KeyError occurs when there's no entry in OS database for a current user.
DEFAULT_USER = None

DEBUG = False
DEBUG = get_option('debug.connection')

TEXT_TYPES = {
FIELD_TYPE.BIT,
Expand Down
3 changes: 2 additions & 1 deletion singlestoredb/mysql/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import sys

from . import err
from ..config import get_option
from ..utils.results import Description
from .charset import MBLENGTH
from .constants import FIELD_TYPE
from .constants import SERVER_STATUS


DEBUG = False
DEBUG = get_option('debug.connection')

NULL_COLUMN = 251
UNSIGNED_CHAR_COLUMN = 251
Expand Down

0 comments on commit 346f3f8

Please sign in to comment.